Skip to content

Commit

Permalink
comment out vectorized builder test
Browse files Browse the repository at this point in the history
  • Loading branch information
thatstoasty committed Jun 7, 2024
1 parent aa04211 commit 8df7337
Showing 1 changed file with 26 additions and 26 deletions.
52 changes: 26 additions & 26 deletions tests/test_performance.mojo
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ fn test_string_builder() raises:
# Create a string from the buffer
var new_builder_write_start_time = now()
var new_builder = StringBuilder()
for _ in range(10000):
for _ in range(100):
_ = new_builder.write_string(
"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod"
" tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim"
Expand All @@ -35,7 +35,7 @@ fn test_string_builder() raises:
# Create a string using the + operator
print("Testing string concatenation performance")
var vec = List[String]()
for i in range(10000):
for i in range(100):
vec.append(
"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod"
" tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim"
Expand Down Expand Up @@ -92,28 +92,28 @@ fn test_string_builder() raises:

fn main() raises:
# test_std_writer_speed()
# test_string_builder()

print("Testing new string builder performance")
# Create a string from the buffer
var new_builder_write_start_time = now()
var new_builder = VectorizedStringBuilder()
for _ in range(100):
_ = new_builder.write_string(
"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod"
" tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim"
" veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea"
" commodo consequat. Duis aute irure dolor in reprehenderit in voluptate"
" velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint"
" occaecat cupidatat non proident, sunt in culpa qui officia deserunt"
" mollit anim id est laborum."
)
var new_builder_write_execution_time = now() - new_builder_write_start_time
print("StringBuilder:", "(", new_builder_write_execution_time, "ns)")

var new_builder_start_time = now()
var new_output = str(new_builder)
var new_builder_execution_time = now() - new_builder_start_time
print(len(new_output))
test_string_builder()

# print("Testing new string builder performance")
# # Create a string from the buffer
# var new_builder_write_start_time = now()
# var new_builder = VectorizedStringBuilder()
# for _ in range(10000):
# _ = new_builder.write_string(
# "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod"
# " tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim"
# " veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea"
# " commodo consequat. Duis aute irure dolor in reprehenderit in voluptate"
# " velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint"
# " occaecat cupidatat non proident, sunt in culpa qui officia deserunt"
# " mollit anim id est laborum."
# )
# var new_builder_write_execution_time = now() - new_builder_write_start_time
# print("StringBuilder:", "(", new_builder_write_execution_time, "ns)")

# var new_builder_start_time = now()
# var new_output = str(new_builder)
# var new_builder_execution_time = now() - new_builder_start_time
# print(len(new_output))
# print(new_output)
print("StringBuilder:", "(", new_builder_execution_time, "ns)")
# print("StringBuilder:", "(", new_builder_execution_time, "ns)")

0 comments on commit 8df7337

Please sign in to comment.