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

Semantic-UI should run faster. jQuery is slow. prefer native JS #6703

Closed
milahu opened this issue Dec 8, 2018 · 6 comments
Closed

Semantic-UI should run faster. jQuery is slow. prefer native JS #6703

milahu opened this issue Dec 8, 2018 · 6 comments

Comments

@milahu
Copy link

milahu commented Dec 8, 2018

Semantic-UI should run faster. jQuery is slow. prefer native JS

Expected Result

run faster

Actual Result

running slow : P

Version

2.4.2

Desc

this concerns the abuse of jQuery.

when i see code like ...

              module.debug('Creating entire dropdown from select');
              $module = $('<div />')
                .attr('class', $input.attr('class') )
                .addClass(className.selection)
                .addClass(className.dropdown)
                .html( templates.dropdown(selectValues) )
                .insertBefore($input)
              ;

in src/definitions/modules/dropdown.js line 360

... i suspect: this cant be fast.

and its not:

  • native createElement is faster by factor 4
  • native setAttribute is faster by factor 4 (setProperty only works for standard attributes)
  • native classList.add is faster by factor 2
  • native innerHTML is faster by factor 1.5 (also faster than createDocumentFragment + createElement + appendChild)
  • jQuery.html is really slow with 'complex xml input' (innerHTML should be fine, since most pages use XHTML, so strings are parsed as XHTML)

etc ...

templates.dropdown is fast, cos it only concats strings
in src/definitions/modules/dropdown.js line 3900

references

https://ilikekillnerds.com/2015/02/stop-writing-slow-javascript/

@ColinFrick
Copy link

Duplicate of #1175

@milahu
Copy link
Author

milahu commented Dec 8, 2018

sorry for dupe-ing

please consider linking to the work-in-progress Vanilla-Semantic-UI in the readme

@Atulin
Copy link

Atulin commented Dec 8, 2018

Unfortunately, #1175 has been buried, and Vanilla-Semantic-UI hasn't seen any updates in 7 months. Looks like native version is still a ways off.

Normally I'd suggest adding your findings about the speed to a relevant issue on Fomantic-UI repo, but fomantic/Fomantic-UI#20. Unless their stance has changed.

@y0hami
Copy link
Member

y0hami commented Dec 8, 2018

@Atulin
Copy link

Atulin commented Dec 8, 2018

Under Nice to have/want.
Still, having it on the roadmap at all is a good thing. I think it could be a good idea to add a link to the roadmap to the referenced issue, since that's the first thing that pops up when searching for jquery.

@milahu
Copy link
Author

milahu commented Dec 8, 2018

thanks for your feedback : ]

quoting rishavs

... removing jquery seems to be one of the most requested features in SUI ...

removing jQuery is rather a luxury problem, with only small gains.
these feature requests show, that SUI is mature, and only lacks like 5% in speed/RAM.

Vanilla-Semantic-UI hasn't seen any updates in 7 months

luxury problem : /

what could help here, are macros for JS
via this

with macros, we could move the abstraction away from JS into the macro language
and use the macro processor, to 'compile' native JS

looks like i finally found a use case for lisp / scheme / rust / nix / sweetjs ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants