Skip to content

Commit b14fa33

Browse files
committed
Use ArrayList instead of LinkedList in java-register.py
* Since the benchmark is hevay on `List#get(int index)`.
1 parent 9848b78 commit b14fa33

File tree

1 file changed

+4
-4
lines changed
  • graalpython/com.oracle.graal.python.benchmarks/python/host_interop

1 file changed

+4
-4
lines changed

graalpython/com.oracle.graal.python.benchmarks/python/host_interop/java-register.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2024, 2024, Oracle and/or its affiliates. All rights reserved.
1+
# Copyright (c) 2024, 2025, Oracle and/or its affiliates. All rights reserved.
22
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
33
#
44
# The Universal Permissive License (UPL), Version 1.0
@@ -42,7 +42,7 @@
4242

4343
import polyglot
4444
import sys
45-
from java.util import List, LinkedList
45+
from java.util import List, ArrayList
4646

4747
@polyglot.interop_type(List)
4848
class JList:
@@ -65,7 +65,7 @@ def length(self):
6565
# igv: function_root_create_list_at
6666
def create_list(num: int, l: JList):
6767
for i in range(num):
68-
l.append(LinkedList())
68+
l.append(ArrayList())
6969
for j in range(i):
7070
l[i].append(j)
7171

@@ -74,7 +74,7 @@ def create_list(num: int, l: JList):
7474
assert li.length() * (li.length() - 1) / 2 == li.get_value()
7575

7676
def measure(num):
77-
j_list = LinkedList()
77+
j_list = ArrayList()
7878
create_list(num, j_list)
7979

8080
def __benchmark__(num=2_000):

0 commit comments

Comments
 (0)