CouchDB
  1. CouchDB
  2. COUCHDB-833

Use Takanori Ishikawa's JS SHA1 implementation which doesn't pollute the global namespace

    Details

    • Type: Improvement Improvement
    • Status: Open
    • Priority: Trivial Trivial
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Futon
    • Labels:
      None
    • Skill Level:
      Regular Contributors Level (Easy to Medium)

      Description

      The current implementation by Paj is slow and pollutes the global namespace with variables and functions. This implementation only exports the SHA1 module and also happens to be up to 3 times faster as an added bonus. See http://bit.ly/9wjjRG for benchmarks.

      1. better_js_sha1.patch
        22 kB
        Devin Torres
      2. better_js_sha1.patch
        21 kB
        Devin Torres

        Activity

        Hide
        Jan Lehnardt added a comment -

        we'd still need it to verify that "old" user docs still work, and it might be required in the ouath tests. that means we could remove it from futon and just have it in the test suite.

        Show
        Jan Lehnardt added a comment - we'd still need it to verify that "old" user docs still work, and it might be required in the ouath tests. that means we could remove it from futon and just have it in the test suite.
        Hide
        Sam Bisbee added a comment -

        Okay ... so does that mean we can remove it?

        Show
        Sam Bisbee added a comment - Okay ... so does that mean we can remove it?
        Hide
        Jan Lehnardt added a comment -

        It used to be used in prepareUserAccount before 1.2.x/1.3.x _users db security changes.

        Show
        Jan Lehnardt added a comment - It used to be used in prepareUserAccount before 1.2.x/1.3.x _users db security changes.
        Hide
        Sam Bisbee added a comment -

        I just did a cursory review of where we use SHA1 in Futon and was under whelmed. As far as I can tell it's really only used in the tests even though it's included in every Futon page (creating a different issue for this).

        If someone cares enough about Futon tests' run time then we could replace the SHA1 implementation, but it doesn't seem like a worthwhile cause to me.

        Cheers.

        Show
        Sam Bisbee added a comment - I just did a cursory review of where we use SHA1 in Futon and was under whelmed. As far as I can tell it's really only used in the tests even though it's included in every Futon page (creating a different issue for this). If someone cares enough about Futon tests' run time then we could replace the SHA1 implementation, but it doesn't seem like a worthwhile cause to me. Cheers.
        Hide
        Chris Anderson added a comment -

        patch doesn't apply cleanly (might be because I did the json2.js update beforehand direct from json.org)

        Can you repost the patch against latest trunk, or a link to your git repo so I can clone directly?

        Thanks!

        Chris

        Show
        Chris Anderson added a comment - patch doesn't apply cleanly (might be because I did the json2.js update beforehand direct from json.org) Can you repost the patch against latest trunk, or a link to your git repo so I can clone directly? Thanks! Chris

          People

          • Assignee:
            Unassigned
            Reporter:
            Devin Torres
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:

              Time Tracking

              Estimated:
              Original Estimate - 1m
              1m
              Remaining:
              Remaining Estimate - 1m
              1m
              Logged:
              Time Spent - Not Specified
              Not Specified

                Development