Re: [PATCHes] LyX and Snow Leopard, going forward

2009-11-04 Thread Jürgen Spitzmüller
BH wrote:

> I've posted a binary here:
> 
> http://edisk.fandm.edu/bennett.helm/lyx/LyX-1.6.5svn-Snow-Leopard-
Test.app.zip
> 

Thanks, Bennett. I'll post a request for testers.

Jürgen



Re: [PATCHes] LyX and Snow Leopard, going forward

2009-11-03 Thread BH
On Tue, Nov 3, 2009 at 10:49 AM, Jean-Marc Lasgouttes
 wrote:
> Jürgen Spitzmüller  writes:
>
>> BH wrote:
>>> I can build and post a binary, but since I don't have Snow Leopard I'm
>>> unable to test.
>>
>> That would be great.
>>
>>> Shall I use the patches first posted in this thread against current branch?
>>
>> I think only the nofork patch is relevant (for 1.6.4.2).
>
> Yes, it applies cleanly. I'll provide a version of the other one for
> branch if relevant.

I've posted a binary here:

http://edisk.fandm.edu/bennett.helm/lyx/LyX-1.6.5svn-Snow-Leopard-Test.app.zip

BH


Re: [PATCHes] LyX and Snow Leopard, going forward

2009-11-03 Thread Jean-Marc Lasgouttes
Jürgen Spitzmüller  writes:

> BH wrote:
>> I can build and post a binary, but since I don't have Snow Leopard I'm
>> unable to test.
>
> That would be great.
>
>> Shall I use the patches first posted in this thread against current branch?
>
> I think only the nofork patch is relevant (for 1.6.4.2).

Yes, it applies cleanly. I'll provide a version of the other one for
branch if relevant.

JMarc


Re: [PATCHes] LyX and Snow Leopard, going forward

2009-11-03 Thread Jürgen Spitzmüller
BH wrote:
> I can build and post a binary, but since I don't have Snow Leopard I'm
> unable to test.

That would be great.

> Shall I use the patches first posted in this thread against current branch?

I think only the nofork patch is relevant (for 1.6.4.2).

Jürgen


Re: [PATCHes] LyX and Snow Leopard, going forward

2009-11-03 Thread BH
On Tue, Nov 3, 2009 at 9:56 AM, Jürgen Spitzmüller  wrote:
> Jean-Marc Lasgouttes wrote:
>> > I am reluctant to push a mac-related change when nobody wants to test it.
>>
>> OTOH, I am confident about the patches.
>
> If we get someone to build the binary, I'm sure we find some people on lyx-
> users to test that.
>
> Jürgen

I can build and post a binary, but since I don't have Snow Leopard I'm
unable to test.

Shall I use the patches first posted in this thread against current branch?

BH


Re: [PATCHes] LyX and Snow Leopard, going forward

2009-11-03 Thread Jürgen Spitzmüller
Jean-Marc Lasgouttes wrote:
> > I am reluctant to push a mac-related change when nobody wants to test it.
> 
> OTOH, I am confident about the patches.

If we get someone to build the binary, I'm sure we find some people on lyx-
users to test that.

Jürgen


Re: [PATCHes] LyX and Snow Leopard, going forward

2009-11-03 Thread Jean-Marc Lasgouttes
Jean-Marc Lasgouttes  writes:
> I am reluctant to push a mac-related change when nobody wants to test it.

OTOH, I am confident about the patches.

JMarc


Re: [PATCHes] LyX and Snow Leopard, going forward

2009-11-03 Thread Jürgen Spitzmüller
Jean-Marc Lasgouttes wrote:
> I am reluctant to push a mac-related change when nobody wants to test it.

I can understand that.

Jürgen


Re: [PATCHes] LyX and Snow Leopard, going forward

2009-11-03 Thread Jean-Marc Lasgouttes
Jürgen Spitzmüller  writes:
> If the fork() disabling proves to be unproblematic, I'd propose to do
> that change in branch as well. What is the status of the autosave
> speedup patch you posted? If it works and if you're confident about
> it, it can be backported as well.

Either these patches work, or nobody tested them :(

> If you want to be super-nice, you could furthermore provide a patch for the 
> 1.6.4.1 source so that someone could build a 1.6.4.2 Mac binary for Snow 
> Leopard.

If I find somebody who can build a mac binary, we could do something
like that. But nobody proposed to help...

I am reluctant to push a mac-related change when nobody wants to test it.

JMarc


Re: [PATCHes] LyX and Snow Leopard, going forward

2009-11-03 Thread Jürgen Spitzmüller
Jean-Marc Lasgouttes wrote:
> > Time to proceeed?
> 
> Yes. What do you want me to do?

If the fork() disabling proves to be unproblematic, I'd propose to do that 
change in branch as well. What is the status of the autosave speedup patch you 
posted? If it works and if you're confident about it, it can be backported as 
well.

The next steps then depend on your plans :-)

If you want to be super-nice, you could furthermore provide a patch for the 
1.6.4.1 source so that someone could build a 1.6.4.2 Mac binary for Snow 
Leopard.

Jürgen


Re: [PATCHes] LyX and Snow Leopard, going forward

2009-11-03 Thread Jean-Marc Lasgouttes
Jürgen Spitzmüller  writes:

> Jean-Marc Lasgouttes wrote:
>> > The patch that disables fork() seems obvious enough to me, but an extra
>> > pair of eyes (and testers) would help.
>> 
>> This part is in trunk now. It will maybe make some people test it. This
>> is all I can do unfortunately.
>
> Time to proceeed?

Yes. What do you want me to do?

JMarc


Re: [PATCHes] LyX and Snow Leopard, going forward

2009-11-03 Thread Jürgen Spitzmüller
Jean-Marc Lasgouttes wrote:
> > The patch that disables fork() seems obvious enough to me, but an extra
> > pair of eyes (and testers) would help.
> 
> This part is in trunk now. It will maybe make some people test it. This
> is all I can do unfortunately.

Time to proceeed?

Jürgen


Re: [PATCHes] LyX and Snow Leopard, going forward

2009-10-23 Thread Jean-Marc Lasgouttes
Jean-Marc Lasgouttes  writes:
> The patch that disables fork() seems obvious enough to me, but an extra
> pair of eyes (and testers) would help.

This part is in trunk now. It will maybe make some people test it. This
is all I can do unfortunately.

> For the speedup part, this can indeed wait for 1.6.5. Windows people
> have been living with the delay forever and they are not dead yet.
> Moreover, different platform may need different optimizations. A mac
> profile would show us where time is spent. I do not think we can have a
> windows profile, unfortunately.

I committed a simpler version of the patch to trunk in order to do
testing. The next thing that looks suspicious on a profile is the time
it takes to write a tabular (I tested on user guide).

JMarc


Re: [PATCHes] LyX and Snow Leopard, going forward

2009-10-20 Thread Jean-Marc Lasgouttes
BH  writes:

> On Mon, Oct 19, 2009 at 10:30 AM, Jean-Marc Lasgouttes
>  wrote:
>>
>> Hello,
>>
>> It seems that nothing is happening on the snow leopard front. This is
>> something that has to be solved ASAP (1.6.4.2?)
>
> Sorry ... I've been swamped and will be for the foreseeable future.

No problem. I am trying to get other people to stand up :) Personnally,
I do not care much (yet) about snow leopard !

JMarc


Re: [PATCHes] LyX and Snow Leopard, going forward

2009-10-20 Thread BH
On Mon, Oct 19, 2009 at 10:30 AM, Jean-Marc Lasgouttes
 wrote:
>
> Hello,
>
> It seems that nothing is happening on the snow leopard front. This is
> something that has to be solved ASAP (1.6.4.2?)

Sorry ... I've been swamped and will be for the foreseeable future.

BH


Re: [PATCHes] LyX and Snow Leopard, going forward

2009-10-19 Thread Jean-Marc Lasgouttes
Jürgen Spitzmüller  writes:

> Jean-Marc Lasgouttes wrote:
>> It seems that nothing is happening on the snow leopard front. This is
>> something that has to be solved ASAP (1.6.4.2?)
>
> definitely. Thanks for coming back to this.
>
> 1.6.4.2 would mean that we would have to patch the 1.6.4.1 sources. Branch is 
> too far off (and would be 1.6.5).

This is what I had in mind. We can maybe make a binary specially for
10.6 (since it will be slower for 10.5 users), unless someone tell me
how to decide whether to disable fork() at runtime.

> How "risky" is this? I'd take it that for 1.6.4.2, the delay would be 
> bearable, if we aim to fix the problem properly in 1.6.5.

The patch that disables fork() seems obvious enough to me, but an extra
pair of eyes (and testers) would help.

For the speedup part, this can indeed wait for 1.6.5. Windows people
have been living with the delay forever and they are not dead yet.
Moreover, different platform may need different optimizations. A mac
profile would show us where time is spent. I do not think we can have a
windows profile, unfortunately.

JMarc


Re: [PATCHes] LyX and Snow Leopard, going forward

2009-10-19 Thread Jürgen Spitzmüller
Jean-Marc Lasgouttes wrote:
> It seems that nothing is happening on the snow leopard front. This is
> something that has to be solved ASAP (1.6.4.2?)

definitely. Thanks for coming back to this.

1.6.4.2 would mean that we would have to patch the 1.6.4.1 sources. Branch is 
too far off (and would be 1.6.5).

> The patch nofork.diff just disables forking altogether on Mac OS X. This
> is definitely a bit rude. If somebody tells me how to determine the OS
> version at runtime, I can update the patch. I'd appreciate if somebody
> could try this patch out.
> 
> The bad part about disabling fork(), as Vincent pointed out, is that
> there is a noticeable delay at each autosave. I took my profiler and
> determined that, on linux, this delay is due the the call to to_utf8
> which is done for each character. The following patch buffers plain
> characters into strings and yield a nice speedup. Some Shark profiles on
> Mac OS X could be useful too. The way I tested was
> 1/ load user guide
> 2/ M-x to open minibuffer
> 3/ run command
>   repeat 60 command-sequence self-insert a  ; undo ; buffer-write

How "risky" is this? I'd take it that for 1.6.4.2, the delay would be 
bearable, if we aim to fix the problem properly in 1.6.5.

Having said that, testing is mandatory anyway.

Jürgen


[PATCHes] LyX and Snow Leopard, going forward

2009-10-19 Thread Jean-Marc Lasgouttes

Hello,

It seems that nothing is happening on the snow leopard front. This is
something that has to be solved ASAP (1.6.4.2?)

The patch nofork.diff just disables forking altogether on Mac OS X. This
is definitely a bit rude. If somebody tells me how to determine the OS
version at runtime, I can update the patch. I'd appreciate if somebody
could try this patch out.

The bad part about disabling fork(), as Vincent pointed out, is that
there is a noticeable delay at each autosave. I took my profiler and
determined that, on linux, this delay is due the the call to to_utf8
which is done for each character. The following patch buffers plain
characters into strings and yield a nice speedup. Some Shark profiles on
Mac OS X could be useful too. The way I tested was
1/ load user guide
2/ M-x to open minibuffer
3/ run command
  repeat 60 command-sequence self-insert a  ; undo ; buffer-write

I also tried to add a big buffer to the ofstream we are using, but this
did not really work.

JMarc

svndiff src/support/ForkedCalls.cpp

Index: src/support/ForkedCalls.cpp
===
--- src/support/ForkedCalls.cpp	(révision 31676)
+++ src/support/ForkedCalls.cpp	(copie de travail)
@@ -192,7 +192,13 @@ void ForkedProcess::kill(int tol)
 
 
 pid_t ForkedProcess::fork() {
-#if !defined (HAVE_FORK)
+/* FIXME fork() is not usable on Mac OS X 10.6 (snow leopard) 
+ *   Use something else like threads.
+ *
+ * Since I do not know how to determine at run time what is the OS X
+ * version, I just disable forking altogether for now (JMarc)
+ */
+#if !defined (HAVE_FORK) || defined(__APPLE__)
 	return -1;
 #else
 	pid_t pid = ::fork();
svndiff src/Paragraph.cpp

Index: src/Paragraph.cpp
===
--- src/Paragraph.cpp	(révision 31676)
+++ src/Paragraph.cpp	(copie de travail)
@@ -90,6 +90,8 @@ public:
 
 	///
 	void insertChar(pos_type pos, char_type c, Change const & change);
+	///
+	void flushWriteBuffer(ostream & os);
 
 	/// Output the surrogate pair formed by \p c and \p next to \p os.
 	/// \return the number of characters written.
@@ -213,6 +215,8 @@ public:
 	Words words_;
 	///
 	Layout const * layout_;
+	/// Use as a buffer in Paragraph::write
+	docstring write_buffer_;
 };
 
 
@@ -1168,6 +1172,13 @@ Paragraph::~Paragraph()
 }
 
 
+void Paragraph::Private::flushWriteBuffer(ostream & os)
+{
+	os << to_utf8(write_buffer_);
+	write_buffer_.erase();
+}
+
+
 void Paragraph::write(ostream & os, BufferParams const & bparams,
 	depth_type & dth) const
 {
@@ -1199,6 +1210,8 @@ void Paragraph::write(ostream & os, Buff
 	for (pos_type i = 0; i <= size(); ++i) {
 
 		Change const change = lookupChange(i);
+		if (change != running_change)
+			d->flushWriteBuffer(os);
 		Changes::lyxMarkChange(os, bparams, column, running_change, change);
 		running_change = change;
 
@@ -1209,6 +1222,7 @@ void Paragraph::write(ostream & os, Buff
 		Font font2 = getFontSettings(bparams, i);
 		font2.setMisspelled(false);
 		if (font2 != font1) {
+			d->flushWriteBuffer(os);
 			font2.lyxWriteChanges(font1, os);
 			column = 0;
 			font1 = font2;
@@ -1218,6 +1232,7 @@ void Paragraph::write(ostream & os, Buff
 		switch (c) {
 		case META_INSET:
 			if (Inset const * inset = getInset(i)) {
+d->flushWriteBuffer(os);
 if (inset->directWrite()) {
 	// international char, let it write
 	// code directly so it's shorter in
@@ -1234,10 +1249,12 @@ void Paragraph::write(ostream & os, Buff
 			}
 			break;
 		case '\\':
+			d->flushWriteBuffer(os);
 			os << "\n\\backslash\n";
 			column = 0;
 			break;
 		case '.':
+			d->flushWriteBuffer(os);
 			if (i + 1 < size() && d->text_[i + 1] == ' ') {
 os << ".\n";
 column = 0;
@@ -1247,13 +1264,14 @@ void Paragraph::write(ostream & os, Buff
 		default:
 			if ((column > 70 && c == ' ')
 			|| column > 79) {
+d->flushWriteBuffer(os);
 os << '\n';
 column = 0;
 			}
 			// this check is to amend a bug. LyX sometimes
 			// inserts '\0' this could cause problems.
 			if (c != '\0')
-os << to_utf8(docstring(1, c));
+d->write_buffer_.push_back(c);
 			else
 LYXERR0("NUL char in structure.");
 			++column;
@@ -1261,6 +1279,7 @@ void Paragraph::write(ostream & os, Buff
 		}
 	}
 
+	d->flushWriteBuffer(os);
 	os << "\n\\end_layout\n";
 }