Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor code that uses String#scan to use StringScanner to improve performance #520

Open
4 tasks
postmodern opened this issue Jul 15, 2024 · 0 comments
Open
4 tasks
Labels
enhancement Enhancement to existing code

Comments

@postmodern
Copy link
Member

StringScanner using a while or until loop is rough 2x faster than String#scan with a block. We should refactor the remaining code that still uses String#scan to use StringScanner.

  • lib/ronin/support/binary/unhexdump/parser.rb (numbers = rest.scan(/ ( )|([^\s]+)/))
  • lib/ronin/support/encoding/base16.rb (data.scan(/../).each do |hex_char|)
  • lib/ronin/support/encoding/hex.rb (data.scan(/../) do |hex|)
  • lib/ronin/support/encoding/sql.rb (data.scan(/../) do |hex_char|)
@postmodern postmodern added the enhancement Enhancement to existing code label Jul 15, 2024
@postmodern postmodern added this to Tidy Jul 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Enhancement to existing code
Projects
Status: No status
Development

No branches or pull requests

1 participant