kdeinit (was: Summary from Buildsystem BoF at Desktop Summit)
Chusslove Illich
caslav.ilic at gmx.net
Sun Aug 21 17:26:19 BST 2011
> [: Thiago Macieira :]
> I once wrote a benchmark comparing iterating over a QString to iterating
> over a gchar UTF-8 string using glib functions to get each UCS-4 character
> (ostensibly to prove that UTF-16 was better than UTF-8). The result was
> clear: Qt code was much faster, over 10x, compared to glib.
>
> [...]
>
> The point is just as above: we, the KDE and Qt communities, are not
> required to learn glib in order to write a new service or library.
Funilly, this is something that I was just intending to do for the sake of
acceptance. I started by looking for the necessary pieces in glib and how
they work, saw glib's iteration over characters, and thought "this has got
to be mightily slower". And the code I want to write will mostly be doing
that.
Do you perhaps still have that benchmark code? Do you have (or know of)
similar benchmarks for XML parsing (GMarkupParser vs. QXmlStreamReader) and
JavaScript (QtScript vs. say SpiderMonkey)? Also, a QRegExp vs. GRegex
benchmark would be nice.
If the Qt-based implementation would be significantly superior in
performance, I gather you would advise just doing it and ignoring any "but
C++... but another dependency..." objections?
Also, with library being native C++, can there be any problem with C
bindings? I tried something like this:
// lib.h
class Foo {
public:
Foo (...);
void doSomething (...);
};
// lib.cpp
#include "lib.h"
Foo::Foo (...) { ... }
void Foo::doSomething (...) { ... }
// c_bindings.h
typedef struct Foo CFoo;
CFoo *foo_new (...);
void foo_dosomething (...);
// c_bindings.cpp
#include "lib.h"
extern "C" {
#include "c_bindings.h"
CFoo *foo_new (...) { return new Foo(...); }
void foo_dosomething (CFoo *a, ...) { a->doSomething(...); }
}
// app_main.c
#include "c_bindings.h"
int main ()
{
CFoo *f;
f = foo_new(...);
foo_dosomething(f, ...);
return 0;
}
I could build it with:
g++ lib.cpp
g++ c_bindings.cpp
gcc app_main.c lib.o c_bindings.o -lstdc++
but I don't know if this test covers everything.
--
Chusslove Illich (Часлав Илић)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20110821/5eaebc33/attachment.sig>
More information about the kde-core-devel
mailing list