Re: [patch 2/2] drivers/chat/vt.c: remove unnecessary code

2005-02-28 Thread colbuse


>On Mon, Feb 28, 2005 at 01:55:28PM +0100, [EMAIL PROTECTED] wrote:
>
>> Avoid changing the state of the console two times in some cases.
>
>A bad change for several reasons.
>
>(i) more object code is generated
>(ii) the code is slower
>(iii) you change something
>
>Straight line code is cheap, jumps are expensive.
>Replacing an assignment by a jump is not an improvement.


I didn't thought to that point... 

You're right, this patch was a bad idea :(.

Sorry about this error...

--
Emmanuel Colbus
Club GNU/Linux
ENSIMAG - Departement telecoms

-
envoyé via Webmail/IMAG !

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [patch 2/2] drivers/chat/vt.c: remove unnecessary code

2005-02-28 Thread Andries Brouwer
On Mon, Feb 28, 2005 at 01:55:28PM +0100, [EMAIL PROTECTED] wrote:

> Avoid changing the state of the console two times in some cases.

A bad change for several reasons.

(i) more object code is generated
(ii) the code is slower
(iii) you change something

Straight line code is cheap, jumps are expensive.
Replacing an assignment by a jump is not an improvement.

But far worse: this is a purposeless microoptimization.
At least one out of every hundred trivial patches is broken.
Thus, a stream of trivial changes will only break the kernel, for no gain.

Andries
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[patch 2/2] drivers/chat/vt.c: remove unnecessary code

2005-02-28 Thread colbuse

Avoid changing the state of the console two times in some cases.


Signed-off-by: Emmanuel Colbus <[EMAIL PROTECTED]>


--- old/drivers/char/vt.c   2004-12-24 22:35:25.0 +0100
+++ new/drivers/char/vt.c   2005-02-28 12:56:46.154311486 +0100
@@ -1571,7 +1571,6 @@
}
switch(vc_state) {
case ESesc:
-   vc_state = ESnormal;
switch (c) {
case '[':
vc_state = ESsquare;
@@ -1585,25 +1584,25 @@
case 'E':
cr(currcons);
lf(currcons);
-   return;
+   break;
case 'M':
ri(currcons);
-   return;
+   break;
case 'D':
lf(currcons);
-   return;
+   break;
case 'H':
tab_stop[x >> 5] |= (1 << (x & 31));
-   return;
+   break;
case 'Z':
respond_ID(tty);
-   return;
+   break;
case '7':
save_cur(currcons);
-   return;
+   break;
case '8':
restore_cur(currcons);
-   return;
+   break;
case '(':
vc_state = ESsetG0;
return;
@@ -1615,14 +1614,15 @@
return;
case 'c':
reset_terminal(currcons,1);
-   return;
+   break;
case '>':  /* Numeric keypad */
clr_kbd(kbdapplic);
-   return;
+   break;
case '=':  /* Appl. keypad */
set_kbd(kbdapplic);
-   return;
+   /* Here, we don't need any break; */
}
+   vc_state = ESnormal;
return;
case ESnonstd:
if (c=='P') {   /* palette escape sequence */



--
Emmanuel Colbus
Club GNU/Linux
ENSIMAG - departement telecoms


-
envoyé via Webmail/IMAG !

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[patch 2/2] drivers/chat/vt.c: remove unnecessary code

2005-02-28 Thread colbuse

Avoid changing the state of the console two times in some cases.


Signed-off-by: Emmanuel Colbus [EMAIL PROTECTED]


--- old/drivers/char/vt.c   2004-12-24 22:35:25.0 +0100
+++ new/drivers/char/vt.c   2005-02-28 12:56:46.154311486 +0100
@@ -1571,7 +1571,6 @@
}
switch(vc_state) {
case ESesc:
-   vc_state = ESnormal;
switch (c) {
case '[':
vc_state = ESsquare;
@@ -1585,25 +1584,25 @@
case 'E':
cr(currcons);
lf(currcons);
-   return;
+   break;
case 'M':
ri(currcons);
-   return;
+   break;
case 'D':
lf(currcons);
-   return;
+   break;
case 'H':
tab_stop[x  5] |= (1  (x  31));
-   return;
+   break;
case 'Z':
respond_ID(tty);
-   return;
+   break;
case '7':
save_cur(currcons);
-   return;
+   break;
case '8':
restore_cur(currcons);
-   return;
+   break;
case '(':
vc_state = ESsetG0;
return;
@@ -1615,14 +1614,15 @@
return;
case 'c':
reset_terminal(currcons,1);
-   return;
+   break;
case '':  /* Numeric keypad */
clr_kbd(kbdapplic);
-   return;
+   break;
case '=':  /* Appl. keypad */
set_kbd(kbdapplic);
-   return;
+   /* Here, we don't need any break; */
}
+   vc_state = ESnormal;
return;
case ESnonstd:
if (c=='P') {   /* palette escape sequence */



--
Emmanuel Colbus
Club GNU/Linux
ENSIMAG - departement telecoms


-
envoyé via Webmail/IMAG !

-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [patch 2/2] drivers/chat/vt.c: remove unnecessary code

2005-02-28 Thread Andries Brouwer
On Mon, Feb 28, 2005 at 01:55:28PM +0100, [EMAIL PROTECTED] wrote:

 Avoid changing the state of the console two times in some cases.

A bad change for several reasons.

(i) more object code is generated
(ii) the code is slower
(iii) you change something

Straight line code is cheap, jumps are expensive.
Replacing an assignment by a jump is not an improvement.

But far worse: this is a purposeless microoptimization.
At least one out of every hundred trivial patches is broken.
Thus, a stream of trivial changes will only break the kernel, for no gain.

Andries
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [patch 2/2] drivers/chat/vt.c: remove unnecessary code

2005-02-28 Thread colbuse


On Mon, Feb 28, 2005 at 01:55:28PM +0100, [EMAIL PROTECTED] wrote:

 Avoid changing the state of the console two times in some cases.

A bad change for several reasons.

(i) more object code is generated
(ii) the code is slower
(iii) you change something

Straight line code is cheap, jumps are expensive.
Replacing an assignment by a jump is not an improvement.


I didn't thought to that point... 

You're right, this patch was a bad idea :(.

Sorry about this error...

--
Emmanuel Colbus
Club GNU/Linux
ENSIMAG - Departement telecoms

-
envoyé via Webmail/IMAG !

-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/