Developing fast, lightweight apps for all popular and even legacy platforms

This forum can be used to talk about general design strategies, new ideas and questions in general related to wxWidgets. If you feel your questions doesn't fit anywhere, put it here.
catalin
Moderator
Moderator
Posts: 1521
Joined: Wed Nov 12, 2008 7:23 am
Location: Romania

Re: Developing fast, lightweight apps for all popular and even legacy platforms

Post by catalin » Wed Feb 22, 2017 1:42 am

doublemax wrote:The minimal supported Windows version for wx 3.x is Windows XP
That is only true starting with 3.1.
wxWidgets 3.0 still supports Win9x and VC6 and will continue to do it [VZ]. Just use the latest 3.0.x release or even its master branch.

AFAIK VC6 does not have any disadvantages related to wxW. It has some funny C++ bugs (like the for loop variable scope), rather poor handling of templates and both poor and buggy STL implementation. If your code can work around such cases then it will do the job just fine.

palacs
Knows some wx things
Knows some wx things
Posts: 45
Joined: Mon May 30, 2016 11:11 am

Re: Developing fast, lightweight apps for all popular and even legacy platforms

Post by palacs » Mon Feb 27, 2017 12:38 pm

Thanks for the infos, doublemax.

I built the latest (git) wxWidgets 2.8 with MSVC 6.0 then finally I was able to test it on a real environment (hardware). It's a Pentium I computer running at 120 MHz with memory 128 MB. Video card is a Matrox Mystique with 2 MB video memory. OS was Windows 95 OSR2.5. I got really promising results with sample applications. Application cold startup time is around 2-3 seconds which is acceptable. Warm start is around a second which I find good. All samples gave a usable interface without serious slowdowns.

However, one thing annoys me a bit. GDI drawing performance is a bit poor. Internet Explorer 4 can load even big HTML files really fast. I installed DirectX 8.0a (last available DirectX for Windows 95) which improved the rendering time of Internet Explorer but meant nothing to any sample application of wxWidgets. I can see the slowness of richtext.exe scrolling with pure eyes. Same is true for any HTML sample app for displaying HTML (e.g. helpview). I loaded all example HTML files of wxWidgets samples into Internet Explorer 4 and scrolling performance was much better than in the own HTML canvases of wxWidgets samples. The slowest were the grid and the listctrl examples. Sample htlbox was also jagging while being scrolled. Other (non-wx) native MFC applications were smooth.

Considering the fact that wxWidgets also uses native controls, is there some setup.h/config.h flag for wxWidgets to use more (or more legacy) acceleration capabilities of GDI?
catalin wrote:wxWidgets 3.0 still supports Win9x and VC6 and will continue to do it [VZ]. Just use the latest 3.0.x release or even its master branch.
That's good to know. Next time I'll try to do a working 3.0.X build with MSVC 6.0 and test it on hardware. As wxWidgets has been developed for many compilers throughout the years, I suppose MSVC compilation won't cause much problems on the wxWidgets part as the code is standardized to the level that's the most compatible. Or am I wrong?
Last edited by palacs on Mon Feb 27, 2017 1:28 pm, edited 1 time in total.

User avatar
doublemax
Moderator
Moderator
Posts: 13990
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Developing fast, lightweight apps for all popular and even legacy platforms

Post by doublemax » Mon Feb 27, 2017 1:27 pm

I don't think that GDI drawing performance is the problem here. It's just that wxRichTextCtrl and wxHTML are relatively slow which becomes visible on an old machine.

If fast HTML display is important, you may have to try to get wx 3.x to work. Its wxWebView control uses the native browser to display html content.
Use the source, Luke!

palacs
Knows some wx things
Knows some wx things
Posts: 45
Joined: Mon May 30, 2016 11:11 am

Re: Developing fast, lightweight apps for all popular and even legacy platforms

Post by palacs » Mon Feb 27, 2017 2:39 pm

Then I would like to make wxRichTextCtrl or wxHTML make a better and optimized use of GDI, like Internet Explorer does. However, these two aren't the slowest. The slowest are grid and dataview.

wxWebView is a good tip, I'll try it. However, I'm not sure this is the best idea, regarding compatibility. What will it do on systems with no native browsers?

User avatar
doublemax
Moderator
Moderator
Posts: 13990
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Developing fast, lightweight apps for all popular and even legacy platforms

Post by doublemax » Mon Feb 27, 2017 3:10 pm

Then I would like to make wxRichTextCtrl or wxHTML make a better and optimized use of GDI, like Internet Explorer does. However, these two aren't the slowest. The slowest are grid and dataview.
Like i said, i don't think the use of GDI is the problem. All drawing operations are slim wrappers around GDI. These controls just do a lot of internal work and i doubt there is much you can do to optimize them. Did you test with a release build with compiler optimizations? Debug builds are usually much slower.

Do you really need all controls? Maybe you can use faster alternatives. E.g. wxListCtrl should be much faster than wxGrid or wxDataViewControl, because it is a native control (wxGrid and wxDVC are not).
wxWebView is a good tip, I'll try it. However, I'm not sure this is the best idea, regarding compatibility. What will it do on systems with no native browsers?
The IE backend should be available everywhere unless the user explicitly removed it. OTOH if you want your application to run on that ancient hardware, you probably have a very specific user base, e.g. in a company. If you have control over the machines, you could tell them what they need in order to run your software.
Use the source, Luke!

palacs
Knows some wx things
Knows some wx things
Posts: 45
Joined: Mon May 30, 2016 11:11 am

Re: Developing fast, lightweight apps for all popular and even legacy platforms

Post by palacs » Wed Mar 01, 2017 12:54 pm

I don't need all controls, and I would define everything out from setup.h when building an application to be released. Currently I'm kind of far from it yet. :D What I really need is a widget set that can display formatted test (rich text or HTML) and some list controls.

By the way, are we sure that wxWdigets 3.0.X still supports Windows 95? I tried to compile wxWidgets 3.0.X (latest from git) for Windows 95 using the toolkit of Microsoft Visual Studio .NET 2003.

First I tried this.

Code: Select all

nmake /f makefile.vc BUILD=release MONOLITHIC=0 SHARED=0 UNICODE=0 RUNTIME_LIBS=static
Compilation was successful, however sample applications did not start under Windows 95 and complained about a missing DLL export GDI32.dll:SetLayout. Tried lowering WINVER and _WIN32_WINNT to 0x0400.

Code: Select all

nmake /f makefile.vc BUILD=release MONOLITHIC=0 SHARED=0 UNICODE=0 RUNTIME_LIBS=static CPPFLAGS="$(CPPFLAGS) /DWINVER=0x0400 /D_WIN32_WINNT=0x0400"
It failed.

Code: Select all

	cl /c /nologo /TP /Fovc_msw\corelib_window.obj /MT /DWIN32  /Zi  /Fd..\..\lib\vc_lib\wxmsw30_core.pdb   /O2 /D_CRT_SECURE_NO_DEPRECATE=1  /D_CRT_NON_CONFORMING_SWPRINTFS=1 /D_SCL_SECURE_NO_WARNINGS=1  /D__NO_VC_CRTDBG__ /D__WXMSW__    /DNDEBUG     /DwxUSE_UNICODE=0   /I..\..\lib\vc_lib\msw /I..\..\include  /W4  /DWXBUILDING /I..\..\src\tiff\libtiff /I..\..\src\jpeg /I..\..\src\png  /I..\..\src\zlib /I..\..\src\regex /I..\..\src\expat\lib /DwxUSE_BASE=0  /GR /EHsc /Yu"wx/wxprec.h"  /Fp"vc_msw\wxprec_corelib.pch"  /DWINVER=0x0400 /D_WIN32_WINNT=0x0400  ..\..\src\msw\window.cpp
window.cpp
..\..\src\msw\window.cpp(3528) : error C2065: 'WM_UNINITMENUPOPUP' : undeclared identifier
..\..\src\msw\window.cpp(3528) : error C2051: case expression not constant
NMAKE : fatal error U1077: 'cl' : return code '0x2'
Stop.
Looks like wxWidgets 3.0.X is already dependent on definitions only available in higher versions of the Windows API. Or can I disable this dependency with some wx... flag or some define in setup.h?

User avatar
doublemax
Moderator
Moderator
Posts: 13990
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Developing fast, lightweight apps for all popular and even legacy platforms

Post by doublemax » Wed Mar 01, 2017 1:43 pm

If a symbol like WM_UNINITMENUPOPUP is used unconditionally (and it is), then wx 3.x does not support Windows 95/98 as this requires at least W2K.

In how many places do you get errors like that? If there are not too many and depending on where they are, you could try to comment these parts out.

Or you could take wxWebView from 3.x and try to integrate it into 2.8.x, although i have a feeling that it will be a lot of work.
Use the source, Luke!

palacs
Knows some wx things
Knows some wx things
Posts: 45
Joined: Mon May 30, 2016 11:11 am

Re: Developing fast, lightweight apps for all popular and even legacy platforms

Post by palacs » Wed Mar 01, 2017 3:18 pm

I see. :(

Back to my "GDI mania" :D is it worth a trying to compile wxWidgets 2.8.X under a Windows 95 machine using MSVC 6.0 to ensure that it will maximize the usage of all capabilities of this specific platform? Regarding GDI drawing performance as well. So far, I compiled under Windows XP which has different capabilities of GDI acceleration and also a different Windows API, however MSVC 6.0 is backwards compatible toward Windows 95.

User avatar
doublemax
Moderator
Moderator
Posts: 13990
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Developing fast, lightweight apps for all popular and even legacy platforms

Post by doublemax » Wed Mar 01, 2017 5:29 pm

Back to my "GDI mania" [...]
I'm 95% sure that the drawing performance is not the problem. It's just that the layout algorithms in both wxHTML and wxRTC are not very fast and on a 100Mhz CPU this becomes very noticeable.

Edit: I just remembered something: Before wxWebView in wx3.x, there was wxActiveX for older wx versions:
https://sourceforge.net/projects/wxactivex/

It's from 2005, so it may require some tweaking to get it to compile with wx 2.8.x, but i'm sure that's the best solution for you. It even has a sample for embedding an IE window.
Use the source, Luke!

palacs
Knows some wx things
Knows some wx things
Posts: 45
Joined: Mon May 30, 2016 11:11 am

Re: Developing fast, lightweight apps for all popular and even legacy platforms

Post by palacs » Thu Mar 02, 2017 11:15 am

Today I found out a kind of interesting fact.

Tried this using an old MinGW that is verified to generate code compatible with Windows 95.

Code: Select all

mingw32-make -f makefile.gcc BUILD=release MONOLITHIC=0 SHARED=0 UNICODE=0 CFLAGS+="-march=i586 -DWINVER=0x0400 -D_WIN32_WINNT=0x0400" CXXFLAGS+="-march=i586 -DWINVER=0x0400 -D_WIN32_WINNT=0x0400" 
Then got this error.

Code: Select all

if not exist ..\..\lib\gcc_lib\msw mkdir ..\..\lib\gcc_lib\msw
if not exist ..\..\lib\gcc_lib\msw\wx mkdir ..\..\lib\gcc_lib\msw\wx
g++ -c -o gcc_msw\corelib_display.o  -O2 -mthreads  -DHAVE_W32API_H -D__WXMSW__   -DNDEBUG       -I..\..\lib\gcc_lib\msw -I..\..\include  -W -Wall -DWXBUILDING -I..\..\src\tiff -I..\..\src\jpeg -I..\..\src\png -I..\..\src\zlib -I..\..\src\regex -I..\..\src\expat\lib -DwxUSE_BASE=0   -Wno-ctor-dtor-privacy  -march=i586 -DWINVER=0x0400 -D_WIN32_WINNT=0x0400 -MTgcc_msw\corelib_display.o -MFgcc_msw\corelib_display.o.d -MD -MP ../../src/msw/display.cpp
../../src/msw/display.cpp: In member function `virtual bool wxDisplayImplWin32Base::IsPrimary() const':
../../src/msw/display.cpp:481: error: `MONITORINFOF_PRIMARY' was not declared in this scope
../../src/msw/display.cpp:481: warning: unused variable 'MONITORINFOF_PRIMARY'
../../src/msw/display.cpp: In member function `virtual int wxDisplayFactoryWin32Base::GetFromPoint(const wxPoint&)':
../../src/msw/display.cpp:580: error: `MONITOR_DEFAULTTONULL' was not declared in this scope
../../src/msw/display.cpp:580: warning: unused variable 'MONITOR_DEFAULTTONULL'
../../src/msw/display.cpp: In member function `virtual int wxDisplayFactoryWin32Base::GetFromWindow(wxWindow*)':
../../src/msw/display.cpp:586: error: `MONITOR_DEFAULTTONULL' was not declared in this scope
../../src/msw/display.cpp:586: warning: unused variable 'MONITOR_DEFAULTTONULL'
mingw32-make: *** [gcc_msw\corelib_display.o] Error 1

Tried specifying only WINVER, because according to this you wouldn't specify _WIN32_WINNT when compiling for Windows 95. The build succeeded.

If wxWidgets 2.8.X officially supports Windows 95, what are the recommendations and requirements for build flags? Does WINVER even influence anything?

palacs
Knows some wx things
Knows some wx things
Posts: 45
Joined: Mon May 30, 2016 11:11 am

Re: Developing fast, lightweight apps for all popular and even legacy platforms

Post by palacs » Wed Mar 29, 2017 9:21 am

Today I was thinking about an idea.

Let's say, I would like to develop an application that is functional on Windows 95 and on Windows 10 64-bit as well. Then I would like it to be functional on not just Windows, but on the latest Ubuntu Linux and Linux Mint, also FreeBSD. Someday I would also like to build it for OS/2.

Windows 95 (and OS/2) requires the 2.8.12 because of some missing defines that makes 3.0.2 impossible to compile for Windows 95. So initially I would develop for 2.8.12, and the legacy problem is solved. Then I would like to go for Windows 10 as well as Ubuntu Linux. Both require wxWidgets 3.0.2. However I could go with 2.8.12 but it is likely to have some missing capabilities that are likely to be triggered on Windows 10.

wxWidgets 3.0.2 has binary compatibility toward 2.8.12.

What if I develop and compile my code for 2.8.12 then link it to 3.0.2?

This would also make it possible to have my 2.8.12 run well in a dynamically linked environment where wxWdigets 3.0.2 is available (like most Linux distributions). 2.8 compatibility is enabled by default.

Would this scenario work properly?

Is it a good or a bad idea?

catalin
Moderator
Moderator
Posts: 1521
Joined: Wed Nov 12, 2008 7:23 am
Location: Romania

Re: Developing fast, lightweight apps for all popular and even legacy platforms

Post by catalin » Wed Mar 29, 2017 9:26 am

palacs wrote:Windows 95 (and OS/2) requires the 2.8.12 because of some missing defines that makes 3.0.2 impossible to compile for Windows 95.
Fixing 3.0.2 to compile for Win95 would be small price to pay compared with the unfixed bugs you will encounter in 2.8.12.
palacs wrote:wxWidgets 3.0.2 has binary compatibility toward 2.8.12.
No, it has not.
palacs wrote:What if I develop and compile my code for 2.8.12 then link it to 3.0.2?
It will fail to link. Better yet: why ask, try it yourself.
palacs wrote:This would also make it possible to have my 2.8.12 run well in a dynamically linked environment where wxWdigets 3.0.2 is available (like most Linux distributions).
For some reason you continue to base your statements on false assumptions. That is most definitely a recipe for failure.
palacs wrote:2.8 compatibility is enabled by default.
That has nothing to do with binary compatibility, but with API compatibility, and that is only partial too.
palacs wrote:Is it a good or a bad idea?
Bad.

palacs
Knows some wx things
Knows some wx things
Posts: 45
Joined: Mon May 30, 2016 11:11 am

Re: Developing fast, lightweight apps for all popular and even legacy platforms

Post by palacs » Wed Mar 29, 2017 2:28 pm

If the 2.8 compatibility in 3.0.2 is only partial then why is it there anyways?

Wouldn't it be the goal to allow wx 2.8 applications to use 3.0 as a library where 2.8 is not available anymore?

catalin
Moderator
Moderator
Posts: 1521
Joined: Wed Nov 12, 2008 7:23 am
Location: Romania

Re: Developing fast, lightweight apps for all popular and even legacy platforms

Post by catalin » Wed Mar 29, 2017 2:37 pm

palacs wrote:If the 2.8 compatibility in 3.0.2 is only partial then why is it there anyways?
To provide API compatibility in sensible areas where upgrading would allegedly be more difficult. You can ask for further details on mailing lists and IRC channel, see the relevant links on the website.
palacs wrote:Wouldn't it be the goal to allow wx 2.8 applications to use 3.0 as a library where 2.8 is not available anymore?
No.
And again, ABI compatibility is different than API compatibility.

palacs
Knows some wx things
Knows some wx things
Posts: 45
Joined: Mon May 30, 2016 11:11 am

Re: Developing fast, lightweight apps for all popular and even legacy platforms

Post by palacs » Wed Mar 29, 2017 2:58 pm

Thank you. Now the picture is clearer.

Post Reply