Skip to content

qt: use c++ for dp()

Fatih Uzunoğlu requested to merge fuzun/vlc:qml-js-to-cpp into master

dp() is very simple. However, it is called many many times.

I thought we can spare some CPU cycles by moving the logic to C++. During bulk calls such as scale change or startup, this may give even additional boost because there should be more CPU cache available when QJSEngine is not involved, thus not cluttering the cache.

This may improve startup, and interface scale change speed by a few milliseconds.

Some notes on JS vs C++ for people who are interested: https://woboq.com/blog/qml-vs-cpp-for-application-startup-time.html

To proceed (@chub), do we need to round the result still? Qt Quick rather uses double for sizing.

Edited by Fatih Uzunoğlu

Merge request reports