[pull] master from GaijinEntertainment:master#837
Merged
Conversation
Compile-time AST lint pass detecting common string performance anti-patterns: - PERF001: string += in loop (O(n^2)) - PERF002: character_at with loop variable index (O(n) per call) - PERF003: character_at anywhere (informational) - PERF004: string interpolation reassignment in loop (O(n^2)) - PERF005: length(string) in while condition (strlen each iteration) Uses counter-based detection via visitor state to catch loop variables nested in expressions (e.g. character_at(s, i+1)). Includes proper variable scope tracking, closure isolation, and deprecation of character_at. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ucture Replace parsing-based warning detection in standalone tool with direct perf_lint(prog, false) call. Make test functions optimization-safe by adding parameters and return values. Remove makeFunctionDeprecated from C++ (character_at deprecation now handled by PERF003 lint rule). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add O(1) first_character() for both string and das_string (throws on empty) - Add with_das_string() to create temporary das_string for block scope - Optimize character_at() to scan only to index instead of full strlen - Replace character_at usage in aot_cpp.das with first_character, slice, and fixed_array indexing - Add perf_lint.rst to language toctree, fix Sphinx warnings - Add handmade docs for new functions and macro_performance_warning - Tests: 5 subtests covering both overloads, empty-throws, and bounds checks Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Rename perf004_* fields to descriptive string_builder_* names - Replace print() with to_log(LOG_WARNING) in perf_lint.das - Flatten nested ifs with postfix conditional returns - Early-return guard in visitExprCall using postfix syntax - Remove spaces before ++/-- operators (project convention) - Move visitor adapter from class field to local variable - Shorten test docs section in perf_lint.rst - Replace if(true) with bare scope block in main.das - Remove unnecessary threadlock_context and unsafe wrapper Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add performance lint module, first_character/with_das_string builtins, optimize character_at
- Fix PERF001 (string += in loop) in constant_expression, coverage, interfaces, rst (5 functions converted to build_string) - Fix PERF003 (character_at(s,0)) in json_boost, regex, rst, strings_boost by replacing with first_character - Fix PERF002 (character_at in loop) in regex expand_replacement and strings_boost is_null_or_whitespace using peek_data - Improve perf_lint: detect character_at(s, 0) and suggest first_character in PERF003 message - Fix perf_lint: PERF003 now fires inside closures (was incorrectly skipped by in_closure guard) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Fix PERF001 warning in split_sptn -- character-by-character string building replaced with strings_boost split(). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- 27_testing: replace character_at loop with peek_data in is_palindrome - 42_testing_tools: replace string += loop with build_string in reverse_string - call_macro_mod: cache length(format) outside while condition (PERF005) - reader_macro_mod: replace string += loop with build_string - typeinfo_macro_mod: replace string += loop with build_string - 07_sse_and_streaming: replace character_at loop with peek_data in SSE parser - Update 4 RST files with matching code changes Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Fix perf_lint warnings across daslib, modules, tutorials
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
See Commits and Changes for more details.
Created by
pull[bot] (v2.0.0-alpha.4)
Can you help keep this open source service alive? 💖 Please sponsor : )