Skip to content

When this conditional expression can be better than anything else? #134

@chiefGui

Description

@chiefGui

Hello guys.

In this conditional pattern doc, you say:

Using the normal pattern will generally outperform the regex (alternative method 1) in a loop, [...]"

Then I made a little test – still doubtful, but can give us an idea: Conditional Expressions Difference.

I really was expecting that regex would be faster/better outside a loop – as I outputted on the alert() – but it doesn't seem to happen.

Yes, I know – jsPerf isn't the most trustful way of performance rating, but as I said, it can give us a starting point.

So, what does "outperform" really means?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions