Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- List<CIBSubjectData> list1 = .....
- list1.forEach(data ->
- merge(data)
- );
- for (CIBSubjectData data : list1) {
- merge(data);
- }
- public class Warmup {
- static int dummy;
- static void merge(String s) {
- dummy += s.length();
- dummy++;
- dummy -= s.length();
- }
- public static void main(String[] args) throws IOException {
- List<String> list1 = new ArrayList<>();
- Random rand = new Random(1);
- for (int i = 0; i < 100_000; i++) {
- list1.add(Long.toString(rand.nextLong()));
- }
- // this will boostrap the bytecode instrumentation
- // Stream.of("foo".toCharArray()).forEach(System.out::println);
- long start = System.nanoTime();
- list1.forEach(data -> merge(data));
- long end = System.nanoTime();
- System.out.printf("duration: %d%n", end - start);
- System.out.println(dummy);
- }
- }
- duration: 71694425
- duration: 7516086
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement