public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/14563] new/delete much slower than malloc/free because of sjlj exceptions
       [not found] <bug-14563-4@http.gcc.gnu.org/bugzilla/>
@ 2012-07-30 23:30 ` steven at gcc dot gnu.org
  2014-02-16 13:13 ` jackie.rosen at hushmail dot com
  1 sibling, 0 replies; 12+ messages in thread
From: steven at gcc dot gnu.org @ 2012-07-30 23:30 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14563

Steven Bosscher <steven at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |steven at gcc dot gnu.org
         Resolution|                            |FIXED
   Target Milestone|---                         |4.3.0
      Known to fail|                            |

--- Comment #51 from Steven Bosscher <steven at gcc dot gnu.org> 2012-07-30 23:29:36 UTC ---
As per Danny's suggestion in comment #50 (impressive...)


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug target/14563] new/delete much slower than malloc/free because of sjlj exceptions
       [not found] <bug-14563-4@http.gcc.gnu.org/bugzilla/>
  2012-07-30 23:30 ` [Bug target/14563] new/delete much slower than malloc/free because of sjlj exceptions steven at gcc dot gnu.org
@ 2014-02-16 13:13 ` jackie.rosen at hushmail dot com
  1 sibling, 0 replies; 12+ messages in thread
From: jackie.rosen at hushmail dot com @ 2014-02-16 13:13 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14563

Jackie Rosen <jackie.rosen at hushmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jackie.rosen at hushmail dot com

--- Comment #52 from Jackie Rosen <jackie.rosen at hushmail dot com> ---
*** Bug 260998 has been marked as a duplicate of this bug. ***
Seen from the domain http://volichat.com
Page where seen: http://volichat.com/adult-chat-rooms
Marked for reference. Resolved as fixed @bugzilla.


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug target/14563] new/delete much slower than malloc/free because of sjlj exceptions
       [not found] <bug-14563-8128@http.gcc.gnu.org/bugzilla/>
@ 2007-06-14  3:21 ` dannysmith at users dot sourceforge dot net
  0 siblings, 0 replies; 12+ messages in thread
From: dannysmith at users dot sourceforge dot net @ 2007-06-14  3:21 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #50 from dannysmith at users dot sourceforge dot net  2007-06-14 03:21 -------
(In reply to comment #37)
> I think basically you are messed up untill Cygwin switches to dwarf2
> exceptions.
> 
This is now (=gcc 4.3) possible by adding --disable-sjlj-exceptions to
configure.
Can we close with milestone gcc-4.3.0?
Danny


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14563


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug target/14563] new/delete much slower than malloc/free because of sjlj exceptions
  2004-03-12 23:36 [Bug c++/14563] New: octave built under Cygwin very slow paulthomas2 at wanadoo dot fr
                   ` (7 preceding siblings ...)
  2005-05-12 14:53 ` pinskia at gcc dot gnu dot org
@ 2005-05-12 14:54 ` pinskia at gcc dot gnu dot org
  8 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-05-12 14:54 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-05-12 14:54 -------
If you used the non throw new, it would become faster.

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14563


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug target/14563] new/delete much slower than malloc/free because of sjlj exceptions
  2004-03-12 23:36 [Bug c++/14563] New: octave built under Cygwin very slow paulthomas2 at wanadoo dot fr
                   ` (6 preceding siblings ...)
  2004-11-14 22:40 ` ken dot duda at gmail dot com
@ 2005-05-12 14:53 ` pinskia at gcc dot gnu dot org
  2005-05-12 14:54 ` pinskia at gcc dot gnu dot org
  8 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-05-12 14:53 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|critical                    |normal


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14563


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug target/14563] new/delete much slower than malloc/free because of sjlj exceptions
  2004-03-12 23:36 [Bug c++/14563] New: octave built under Cygwin very slow paulthomas2 at wanadoo dot fr
                   ` (5 preceding siblings ...)
  2004-11-14 18:04 ` paulthomas2 at wanadoo dot fr
@ 2004-11-14 22:40 ` ken dot duda at gmail dot com
  2005-05-12 14:53 ` pinskia at gcc dot gnu dot org
  2005-05-12 14:54 ` pinskia at gcc dot gnu dot org
  8 siblings, 0 replies; 12+ messages in thread
From: ken dot duda at gmail dot com @ 2004-11-14 22:40 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From ken dot duda at gmail dot com  2004-11-14 22:40 -------
Subject: Re:  new/delete much slower than malloc/free because of sjlj exceptions

> Did you miss the question?

Umm, apparently I did.. the only thing I see in the bug log that looks
like a question is this:

> Does this imply that I have picked up Dwarf2 as a default?

I don't know the answer.  The only thing I can say that might be
related is that there are assembly statements in my output like "call
__Unwind_SjLj_Register"; that (with the --enable-sjlj-exceptions) has
led me to believe I'm using SjLj exceptions.

Again, let me know if there's anything I can help with.

   -Ken



On 14 Nov 2004 18:04:07 -0000, paulthomas2 at wanadoo dot fr
<gcc-bugzilla@gcc.gnu.org> wrote:
> 
> ------- Additional Comments From paulthomas2 at wanadoo dot fr  2004-11-14 18:04 -------
> Subject: Re:  new/delete much slower than malloc/free because
> of sjlj exceptions
> 
> 
> Ken,
> 
> Did you miss the question?
> 
> Paul
> 
>


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14563


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug target/14563] new/delete much slower than malloc/free because of sjlj exceptions
  2004-03-12 23:36 [Bug c++/14563] New: octave built under Cygwin very slow paulthomas2 at wanadoo dot fr
                   ` (4 preceding siblings ...)
  2004-11-14 17:03 ` ken dot duda at gmail dot com
@ 2004-11-14 18:04 ` paulthomas2 at wanadoo dot fr
  2004-11-14 22:40 ` ken dot duda at gmail dot com
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 12+ messages in thread
From: paulthomas2 at wanadoo dot fr @ 2004-11-14 18:04 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From paulthomas2 at wanadoo dot fr  2004-11-14 18:04 -------
Subject: Re:  new/delete much slower than malloc/free because
 of sjlj exceptions


Ken,

Did you miss the question?

Paul

>>(iii) gcc 4.0.0 20041010 (experimental) I get 0.62 and 0.59micro-sec/new
>>
>>This latter was a tad unexpected - I built in from a snapshot on one of the
>>German mirror sites.  Does this imply that I have picked up Dwarf2 as a
>>default?
>>    
>>
>
>
>  
>





-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14563


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug target/14563] new/delete much slower than malloc/free because of sjlj exceptions
  2004-03-12 23:36 [Bug c++/14563] New: octave built under Cygwin very slow paulthomas2 at wanadoo dot fr
                   ` (3 preceding siblings ...)
  2004-11-13 11:03 ` paulthomas2 at wanadoo dot fr
@ 2004-11-14 17:03 ` ken dot duda at gmail dot com
  2004-11-14 18:04 ` paulthomas2 at wanadoo dot fr
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 12+ messages in thread
From: ken dot duda at gmail dot com @ 2004-11-14 17:03 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From ken dot duda at gmail dot com  2004-11-14 17:03 -------
Subject: Re:  new/delete much slower than malloc/free because of sjlj exceptions

Thanks, Paul.  Let me know if I can help in any way.  I appeneded the
output of "gcc -v".

   -Ken

===============================================

Reading specs from /usr/lib/gcc-lib/i686-pc-cygwin/3.3.3/specs
Configured with: /gcc/gcc-3.3.3-3/configure --verbose --prefix=/usr
--exec-prefix=/usr --sysconfdir=/etc --libdir=/usr/lib
--libexecdir=/usr/lib --mandir=/usr/share/man
--infodir=/usr/share/info
--enable-languages=c,ada,c++,d,f77,java,objc,pascal --enable-nls
--without-included-gettext --enable-libgcj --with-system-zlib
--enable-interpreter --enable-threads=posix --enable-java-gc=boehm
--enable-sjlj-exceptions --disable-version-specific-runtime-libs
--disable-win32-registry
Thread model: posix
gcc version 3.3.3 (cygwin special)

====================================================

On 13 Nov 2004 11:03:05 -0000, paulthomas2 at wanadoo dot fr
<gcc-bugzilla@gcc.gnu.org> wrote:
> 
> That's interesting....
> 
> Using your test case:
> (i) gcc 3.2 20020927 ( prerelease) both versions take 0.62micro-sec/new
> (ii) gcc 3.1.1 (cygming special) I get 2.1 and 0.66micro-sec/new
> (iii) gcc 4.0.0 20041010 (experimental) I get 0.62 and 0.59micro-sec/new
> 
> This latter was a tad unexpected - I built in from a snapshot on one of the
> German mirror sites.  Does this imply that I have picked up Dwarf2 as a
> default?


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14563


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug target/14563] new/delete much slower than malloc/free because of sjlj exceptions
  2004-03-12 23:36 [Bug c++/14563] New: octave built under Cygwin very slow paulthomas2 at wanadoo dot fr
                   ` (2 preceding siblings ...)
  2004-11-10 17:05 ` kjd at duda dot org
@ 2004-11-13 11:03 ` paulthomas2 at wanadoo dot fr
  2004-11-14 17:03 ` ken dot duda at gmail dot com
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 12+ messages in thread
From: paulthomas2 at wanadoo dot fr @ 2004-11-13 11:03 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From paulthomas2 at wanadoo dot fr  2004-11-13 11:02 -------
Subject: Re:  new/delete much slower than malloc/free because of sjlj exceptions

> Here's a test case for you...
>    -Ken

That's interesting....

Using your test case:
(i) gcc 3.2 20020927 ( prerelease) both versions take 0.62micro-sec/new
(ii) gcc 3.1.1 (cygming special) I get 2.1 and 0.66micro-sec/new
(iii) gcc 4.0.0 20041010 (experimental) I get 0.62 and 0.59micro-sec/new

This latter was a tad unexpected - I built in from a snapshot on one of the
German mirror sites.  Does this imply that I have picked up Dwarf2 as a
default?

Going back to the beginning of this rather long thread, you will note that
it was building octave that first exposed this problem.  I think that octave
is calling new too many times anyway, for certain types of code, and had
started hanging counters on an overloaded new operator.  It would not be a
big deal to substitute your version and to compare the performance with
THROW defined or not.

Give me a few days, the build takes a few hours under Cygwin and I have some
concreting to do this weekend.... *sigh*

Regards

Paul Thomas



-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14563


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug target/14563] new/delete much slower than malloc/free because of sjlj exceptions
  2004-03-12 23:36 [Bug c++/14563] New: octave built under Cygwin very slow paulthomas2 at wanadoo dot fr
  2004-11-10 12:46 ` [Bug target/14563] new/delete much slower than malloc/free because of sjlj exceptions pinskia at gcc dot gnu dot org
  2004-11-10 16:20 ` ron_hylton at hotmail dot com
@ 2004-11-10 17:05 ` kjd at duda dot org
  2004-11-13 11:03 ` paulthomas2 at wanadoo dot fr
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 12+ messages in thread
From: kjd at duda dot org @ 2004-11-10 17:05 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From kjd at duda dot org  2004-11-10 17:05 -------
(In reply to comment #40)
> Ron, can you please attach your testcase that shows the problem to this PR?
> This PR is a regression on cygwin because the speed is back with 3.2.

Here's a test case for you...
   -Ken

-------------------------------------------------------


// Uncomment one of these defines.
// With the first define uncommented, I get 3.293 usec per "operator new" use.
// With the second define uncommented, I get 1.019 usec per "operator new" use.
// A high price to pay for having one's exceptions properly declared!

//#define THROW throw (std::bad_alloc)
#define THROW


// These definitions are taken straight from libstdc++.


#include "new"
#include <exception_defines.h>

using std::new_handler;
using std::bad_alloc;

extern "C" void *malloc (std::size_t);
extern new_handler __new_handler;

void *
operator new (std::size_t sz) THROW
{
  void *p;

  /* malloc (0) is unpredictable; avoid it.  */
  if (sz == 0)
    sz = 1;
  p = (void *) malloc (sz);
  while (p == 0)
    {
      new_handler handler = __new_handler;
      if (! handler)
#ifdef __EXCEPTIONS
	throw bad_alloc();
#else
        std::abort();
#endif
      handler ();
      p = (void *) malloc (sz);
    }

  return p;
}

void *
operator new[] (std::size_t sz) THROW
{
  return ::operator new(sz);
}




#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <assert.h>

typedef unsigned long long u64;
typedef u64 Usec;

#ifdef WIN32

#include <Windows.h>

inline Usec Now()
{
   DWORD ticks = GetTickCount();
   return ((Usec) ticks) * 1000;
}

#else

#include <sys/types.h>
#include <sys/time.h>

inline Usec Now()
{
   struct timeval tv;
   if( gettimeofday( &tv, 0 ) ) {
      perror( "gettimeofday" );
      exit( 1 );
   }
   return ((Usec) tv.tv_sec) * 1000000 + tv.tv_usec;
}

#endif

using namespace std;



main()
{
  int sizeMin = 4;
  int sizeMax = 100;
  int allocsOutstanding = 1000;
  int reps = 1000;
  int allocsPerRep = 1000;

  int sizeRange = sizeMax - sizeMin;
  char ** ptrs = (char **) malloc( sizeof( char * ) * allocsOutstanding );
  memset( ptrs, 0, sizeof( char * ) * allocsOutstanding );

  Usec start = Now();
  
  int m = reps;
  while( m-- ) {
    int n = allocsPerRep;
    while( n-- ) {
      int r = rand();
      int index = r % allocsOutstanding;
      char * p = ptrs[index];
      delete[] p;
      //      free( p );
      int size = (r % sizeRange) + sizeMin;
      p = new char[ size ];
      //      p = (char *) malloc( size );
      ptrs[index] = p;
    }
  }

  Usec stop = Now();
  double t = ((double) stop - start) / ((double) allocsPerRep * reps);
  printf( "cost of new + delete is about %0.3f usec\n", t );
  fflush( stdout );
}


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14563


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug target/14563] new/delete much slower than malloc/free because of sjlj exceptions
  2004-03-12 23:36 [Bug c++/14563] New: octave built under Cygwin very slow paulthomas2 at wanadoo dot fr
  2004-11-10 12:46 ` [Bug target/14563] new/delete much slower than malloc/free because of sjlj exceptions pinskia at gcc dot gnu dot org
@ 2004-11-10 16:20 ` ron_hylton at hotmail dot com
  2004-11-10 17:05 ` kjd at duda dot org
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 12+ messages in thread
From: ron_hylton at hotmail dot com @ 2004-11-10 16:20 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From ron_hylton at hotmail dot com  2004-11-10 16:20 -------
(In reply to comment #40)
> Ron, can you please attach your testcase that shows the problem to this PR?
> 
> This PR is a regression on cygwin because the speed is back with 3.2.

This is the test case I was using:

#include <iostream>
#include <stdio.h>
#include <time.h>
#include <string>
using namespace std;

int main()
{
	int array_size = 100;
	int loop_count = 3000000;
	try
	{
		long t1 = clock();
		for (int iloop = 0; iloop < loop_count; iloop++)
		{
			int *myarray = new int [array_size];
			delete [] myarray;
		}
		long t2 = clock();
		double delt1 = (double)( t2 - t1 )/ (double)(CLOCKS_PER_SEC);
		cout << "done looping time 1=" << delt1 << endl;
		long t3 = clock();

		for (int jloop = 0; jloop < loop_count; jloop++)
		{
			int *myarray = (int *)malloc(array_size * sizeof(int));
			if (myarray== NULL) { printf("alloc failed\n"); exit(1); }
			else free (myarray);
		}
		long t4 = clock();
		double delt2 = (double)( t4 - t3 )/ (double)(CLOCKS_PER_SEC);
		cout << "done looping time 2=" << delt2 << endl;
	}
	catch (...)
	{
		cout << "exception" << std::endl;
		return 1;
	}

	return 0;
}


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14563


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug target/14563] new/delete much slower than malloc/free because of sjlj exceptions
  2004-03-12 23:36 [Bug c++/14563] New: octave built under Cygwin very slow paulthomas2 at wanadoo dot fr
@ 2004-11-10 12:46 ` pinskia at gcc dot gnu dot org
  2004-11-10 16:20 ` ron_hylton at hotmail dot com
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-11-10 12:46 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[3.3/3.4/4.0 Regression]    |new/delete much slower than
                   |new/delete much slower than |malloc/free because of sjlj
                   |malloc/free because of sjlj |exceptions
                   |exceptions                  |
   Target Milestone|3.3.6                       |---


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14563


^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2014-02-16 13:13 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-14563-4@http.gcc.gnu.org/bugzilla/>
2012-07-30 23:30 ` [Bug target/14563] new/delete much slower than malloc/free because of sjlj exceptions steven at gcc dot gnu.org
2014-02-16 13:13 ` jackie.rosen at hushmail dot com
     [not found] <bug-14563-8128@http.gcc.gnu.org/bugzilla/>
2007-06-14  3:21 ` dannysmith at users dot sourceforge dot net
2004-03-12 23:36 [Bug c++/14563] New: octave built under Cygwin very slow paulthomas2 at wanadoo dot fr
2004-11-10 12:46 ` [Bug target/14563] new/delete much slower than malloc/free because of sjlj exceptions pinskia at gcc dot gnu dot org
2004-11-10 16:20 ` ron_hylton at hotmail dot com
2004-11-10 17:05 ` kjd at duda dot org
2004-11-13 11:03 ` paulthomas2 at wanadoo dot fr
2004-11-14 17:03 ` ken dot duda at gmail dot com
2004-11-14 18:04 ` paulthomas2 at wanadoo dot fr
2004-11-14 22:40 ` ken dot duda at gmail dot com
2005-05-12 14:53 ` pinskia at gcc dot gnu dot org
2005-05-12 14:54 ` pinskia at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).