本地跑的,cpu是i9-13代,内存32G
方法是这个:
public static void main(String[] args) { int i = 1000000; int i2 = 100; StopWatch watch = new StopWatch(); watch.start(); Set<Long> ids = new HashSet<>(); for (int i21 = i2; i21 > 0; i21--) { for (int i1 = 0; i1 < i; i1++) { ids.add(IdUtil.getSnowflake().nextId()); } System.out.println(ids.size()); } watch.stop(); System.out.println(watch.getLastTaskTimeMillis()); }
实际跑了7600万,然后OOM了,内存是8G