Skip to content

Commit 6d67769

Browse files
committed
[0008_inline_strip] Strip inline, don't do a second iteration
--------------------------------------------------------------------------------------------------------- benchmark: 4 tests --------------------------------------------------------------------------------------------------------- Name (time in ns) Min Max Mean StdDev Median IQR Outliers OPS (Kops/s) Rounds Iterations -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- test_benchmark_extract_tokens_short_simple 790.9257 (1.0) 25,041.9835 (1.00) 965.2633 (1.0) 690.2278 (5.36) 917.0035 (1.0) 42.0259 (1.02) 261;825 1,035.9868 (1.0) 55814 1 test_benchmark_extract_tokens_long_simple 1,207.9254 (1.53) 568,790.9434 (22.75) 1,424.0680 (1.48) 1,607.7592 (12.49) 1,415.9596 (1.54) 83.0041 (2.02) 544;6540 702.2137 (0.68) 179118 1 test_benchmark_extract_tokens_short_nested 1,499.8950 (1.90) 24,999.9575 (1.0) 1,632.3808 (1.69) 136.4377 (1.06) 1,625.0415 (1.77) 41.0946 (1.0) 1290;4671 612.6022 (0.59) 146349 1 test_benchmark_extract_tokens_long_nested 2,291.0535 (2.90) 28,708.0184 (1.15) 2,454.3364 (2.54) 128.6998 (1.0) 2,457.9931 (2.68) 42.0259 (1.02) 1624;8542 407.4421 (0.39) 146349 1 --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1 parent aa5d838 commit 6d67769

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

casbin/persist/adapter.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,12 @@ def _extract_tokens(line):
4747
elif not stack:
4848
# must be a comma outside of any nesting: we've found the end of a top level token so
4949
# save that and start a new one
50-
tokens.append(line[start_idx : match.start()])
50+
tokens.append(line[start_idx : match.start()].strip())
5151
start_idx = match.end()
5252

5353
# trailing token after the last ,
54-
tokens.append(line[start_idx:])
54+
tokens.append(line[start_idx:].strip())
5555

56-
tokens = [x.strip() for x in tokens]
5756
return tokens
5857

5958

0 commit comments

Comments
 (0)