[SERVER-19370] String.endsWith() shouldn't use regexp (even escaped) Created: 13/Jul/15 Updated: 19/Sep/15 Resolved: 30/Jul/15 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | JavaScript |
| Affects Version/s: | None |
| Fix Version/s: | 3.1.7 |
| Type: | Improvement | Priority: | Major - P3 |
| Reporter: | Kevin Pulo | Assignee: | Jonathan Reams |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||
| Backwards Compatibility: | Fully Compatible | ||||||||
| Sprint: | Build 7 08/10/15 | ||||||||
| Participants: | |||||||||
| Description |
|
The implementation of String.endsWith() needlessly uses regexps:
Safer and almost certainly faster is to use indexOf() to just directly check the end of the string:
|
| Comments |
| Comment by Githook User [ 30/Jul/15 ] |
|
Author: {u'username': u'jbreams', u'name': u'Jonathan Reams', u'email': u'jbreams@mongodb.com'}Message: |