Skip to content

[Java Practices] Pattern.compile() only needs to be called once per RipperInterface implementation, as it stands it looks like It's being called by every single instance on every keystroke on text-box entry. #942

Open
@GenuineSounds

Description

@GenuineSounds
  • Ripme version: All
  • Java version: N/A
  • Operating system: N/A
  • Exact URL you were trying to rip when the problem occurred: All
  • Please include any additional information about how to reproduce the problem: Look at the code.

Current Behavior

All Patterns in all the classes that implement RipperInterface (not the interfaces fault, just the implementation) should only call the Pattern compilation once as compilation is not exactly free. This occurs in basically every instance of RipperInterface classes on every single getGID() call as currently written and implemented and is worth having the the Patterns delegated to a instance variable.

If not too intrusive it might also be worth having the instance variable in AbstractHTMLRipper or even higher in the hierarchy. Of course one might implement a static field and/or method (in each class) since each Pattern is unique to the class and once Pattern.compile() is called it need not again.

This isn't a 'problem' that is likely to cause far too many problems but a Pattern compilation doesn't need to be called by every ripper, on every single keystroke of text box entry. That in and of itself could lead to problems later down the line and the problems are easily avoidable.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions