topcontexts

Milian Wolff mail at milianw.de
Fri Apr 13 19:24:35 UTC 2018


On Mittwoch, 11. April 2018 10:25:56 CEST René J.V. Bertin wrote:
> Hi,
> 
> Apologies for making this thread yet a bit more endless. I am going to
> return that suggestion to profile right back at you, Milian.

No, that's not how it works. I won't spent my time on your tasks. Forget it.

> I don't know if the idea to use mmap is yours, but you brought up its
> existence and have already profiled KDevelop before (and are clearly used
> to doing that).
> 
> I think we should see some concise, quantitative justification of using
> thousands of mmap resources if the implementation states it could be
> problematic and the fallback code does basically the same thing. (The
> fallback reads the file remainder into a buffer, and then delete the
> QFile*; given the average size of those files that content could well
> already have been buffered anyway.)
> 
> There are over 5000 topcontext files in my session that has the KDevelop
> project, and on Mac mmaps will show up among the open files in the process
> inspector. I've added a simple QElapsedTimer to the background parser's
> updateProgress method (see below) and can confirm that I don't see
> systematic differences there. If more precise data obtained through
> profiling can show that there is indeed a (real-world) performance benefit
> to the mmap approach then fine (and maybe next time I'll try to profile
> something myself). If not, how is that not a waste of resources that could
> be used better elsewhere?
> 
> --- background parser timer (a priori meant to time a full project reparse
> but maybe I should keep track of all timings and print some stats on exit)
> 
> diff --git a/kdevplatform/language/backgroundparser/backgroundparser.cpp
> b/kdevplatform/language/backgroundparser/backgroundparser.cpp index
> f76cb612e2f4505e97c3371a36b0c36e26592cb5..19a4eeb3fe41e5e22d8b0bce893b04189
> 0091bdf 100644 ---
> a/kdevplatform/language/backgroundparser/backgroundparser.cpp
> +++ b/kdevplatform/language/backgroundparser/backgroundparser.cpp
> @@ -30,6 +30,7 @@
>  #include <QMutexLocker>
>  #include <QPointer>
>  #include <QTimer>
> +#include <QElapsedTimer>
>  #include <QThread>
> 
>  #include <KConfigGroup>
> @@ -195,6 +196,7 @@ public:
>          m_timer.setSingleShot(true);
>          m_progressTimer.setSingleShot(true);
>          m_progressTimer.setInterval(500);
> +        m_totalTimer.invalidate();
> 
>          ThreadWeaver::setDebugLevel(true, 1);
> 
> @@ -507,6 +513,7 @@ config.readEntry(entry, oldConfig.readEntry(entry,
> default)) int m_progressMax = 0;
>      int m_progressDone = 0;
>      QTimer m_progressTimer;
> +    QElapsedTimer m_totalTimer;
>  };
> 
>  BackgroundParser::BackgroundParser(ILanguageController *languageController)
> @@ -763,6 +770,9 @@ void BackgroundParser::updateProgressData()
>          if (!d->m_progressTimer.isActive()) {
>              d->m_progressTimer.start();
>          }
> +        if (!d->m_totalTimer.isValid()) {
> +            d->m_totalTimer.start();
> +        }
>      }
> 
>      // Cancel progress updating and hide progress-bar when parsing is done.
> @@ -772,6 +782,13 @@ void BackgroundParser::updateProgressData()
>          if (d->m_progressTimer.isActive()) {
>              d->m_progressTimer.stop();
>          }
> +        if (d->m_totalTimer.isValid()) {
> +            qreal elapsed = d->m_totalTimer.elapsed() / 1000.0;
> +            d->m_totalTimer.invalidate();
> +            if (qEnvironmentVariableIsSet("KDEV_BACKGROUNDPARSER_TIMINGS"))
> { +                qCInfo(LANGUAGE) << "Finished background parse job(s)
> in" << elapsed << "seconds"; +            }
> +        }
>          emit d->m_parser->hideProgress(d->m_parser);
>      }
>  }


-- 
Milian Wolff
mail at milianw.de
http://milianw.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kdevelop-devel/attachments/20180413/d2fb41cf/attachment.sig>


More information about the KDevelop-devel mailing list