[OSM-dev] [novice] osm2pgsql: mac os x: faster with compiler optimized flag -fast instead of -O2

Ceriel Jacobs cerieljacobs at gmail.com
Mon Feb 9 14:38:47 GMT 2009


After checking out osm2pgsql revision 13632,
makefile flag can be changed to -fast and make runs without errors,  
only two warnings.

The osm2pgsql performance difference when loading a 1.457.533.013  
bytes, 11 january 2009 dated, planet-nl-latest.osm:

r13576 with -O2: 11 minutes 04 seconds
r13632 with -fast: 10 minutes 47 seconds

This is a not so shocking 2.5% speed increase.


~Ceriel
---
Environment: Mac mini 2.0Ghz, 4GB RAM, OS X 10.5.6, gcc 4.0.1
---
$ make
gcc -g -fast -Wall -Wextra -I/usr/include/libxml2 -I/opt/local/include  
-I/opt/local/include/postgresql83 -DVERSION=\"0.60-20090209\" - 
DHAVE_PTHREAD   -c -o expire-tiles.o expire-tiles.c
gcc -g -fast -Wall -Wextra -I/usr/include/libxml2 -I/opt/local/include  
-I/opt/local/include/postgresql83 -DVERSION=\"0.60-20090209\" - 
DHAVE_PTHREAD   -c -o middle-pgsql.o middle-pgsql.c
gcc -g -fast -Wall -Wextra -I/usr/include/libxml2 -I/opt/local/include  
-I/opt/local/include/postgresql83 -DVERSION=\"0.60-20090209\" - 
DHAVE_PTHREAD   -c -o middle-ram.o middle-ram.c
gcc -g -fast -Wall -Wextra -I/usr/include/libxml2 -I/opt/local/include  
-I/opt/local/include/postgresql83 -DVERSION=\"0.60-20090209\" - 
DHAVE_PTHREAD   -c -o osm2pgsql.o osm2pgsql.c
osm2pgsql.c: In function 'usage':
osm2pgsql.c:450: warning: implicit declaration of function 'basename'
osm2pgsql.c:450: warning: initialization makes pointer from integer  
without a cast
gcc -g -fast -Wall -Wextra -I/usr/include/libxml2 -I/opt/local/include  
-I/opt/local/include/postgresql83 -DVERSION=\"0.60-20090209\" - 
DHAVE_PTHREAD   -c -o output-pgsql.o output-pgsql.c
g++ -g -fast -Wall -DGEOS_INLINE -g -fast -Wall -Wextra -I/usr/include/ 
libxml2 -I/opt/local/include -I/opt/local/include/postgresql83 - 
DVERSION=\"0.60-20090209\" -DHAVE_PTHREAD -I/opt/local/include   -c -o  
build_geometry.o build_geometry.cpp
g++ -o osm2pgsql UTF8sanitizer.o expire-tiles.o input.o keyvals.o  
middle-pgsql.o middle-ram.o osm2pgsql.o output-pgsql.o pgsql.o rb.o  
reprojection.o sprompt.o text-tree.o build_geometry.o -L/usr/lib - 
lxml2 -lz -lpthread -licucore -lm  -L/opt/local/lib -lgeos -L/opt/ 
local/lib/postgresql83 -lpq -lbz2 -lz -g -lproj -lstdc++ -lpthread


Op 8 feb 2009, om 00:38 heeft Jon Burgess het volgende geschreven:

> On Sat, 2009-02-07 at 23:09 +0100, Ceriel Jacobs wrote:
>> In building and benchmarking open source projects on Mac OS X 10.5
>> intel (for example Mysql),
>> highest performance was returned with flag -fast instead of -O2.
>>
>> When trying to apply these settings to the osm2pgsql Makefile, by
>> replacing:
>> 1. CFLAGS += -g -O2 -Wall -Wextra
>> with
>> 1. CFLAGS += -g -fast -Wall -Wextra
>> and
>> 2. CXXFLAGS += -g -O2 -Wall -DGEOS_INLINE $(CFLAGS)
>> with
>> 2. CXXFLAGS += -g -fast -Wall -DGEOS_INLINE $(CFLAGS)
>>
>> Checked out revision 13576, returns several errors when trying to  
>> make
>> (see below).
>>
>> Has anyone tried this -fast FLAG in the make process of osm2pgsql?
>> Or will this definately not work, and why?
>>
>> ~Ceriel
>
> Try r13578. It should have fixes for the error and the warnings.
>
> I have not tried OSX. I can not tell you how it will effect the
> performance.
>
> 	Jon
>
>





More information about the dev mailing list