mirror of
https://git.hardenedbsd.org/hardenedbsd/HardenedBSD.git
synced 2025-01-01 00:18:15 +01:00
Speed up the inner loop of ansi_put() by a few percent.
syscons' output is now only about 4-5 times slower than I want. It loses a factor of 2 for scrolling output by unnecessarily copying the screen buffer, a factor of 4/3 for dumb OPOST processing, and a factor of 3/2 for clist processing.
This commit is contained in:
parent
7fbcd76bb5
commit
f2fb20ef41
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=9483
@ -25,7 +25,7 @@
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $Id: syscons.c,v 1.117 1995/05/30 08:03:13 rgrimes Exp $
|
||||
* $Id: syscons.c,v 1.118 1995/06/14 05:16:12 bde Exp $
|
||||
*/
|
||||
|
||||
#include "sc.h"
|
||||
@ -1860,7 +1860,15 @@ outloop:
|
||||
u_short cur_attr = scp->term.cur_attr;
|
||||
u_short *cursor_pos = scp->cursor_pos;
|
||||
do {
|
||||
*cursor_pos++ = (scr_map[*ptr++] | cur_attr);
|
||||
/*
|
||||
* gcc-2.6.3 generates poor (un)sign extension code. Casting the
|
||||
* pointers in the following to volatile should have no effect,
|
||||
* but in fact speeds up this inner loop from 26 to 18 cycles
|
||||
* (+ cache misses) on i486's.
|
||||
*/
|
||||
#define UCVP(ucp) ((u_char volatile *)(ucp))
|
||||
*cursor_pos++ = UCVP(scr_map)[*UCVP(ptr)] | cur_attr;
|
||||
ptr++;
|
||||
cnt--;
|
||||
} while (cnt && PRINTABLE(*ptr));
|
||||
len -= (cursor_pos - scp->cursor_pos);
|
||||
|
@ -25,7 +25,7 @@
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $Id: syscons.c,v 1.117 1995/05/30 08:03:13 rgrimes Exp $
|
||||
* $Id: syscons.c,v 1.118 1995/06/14 05:16:12 bde Exp $
|
||||
*/
|
||||
|
||||
#include "sc.h"
|
||||
@ -1860,7 +1860,15 @@ outloop:
|
||||
u_short cur_attr = scp->term.cur_attr;
|
||||
u_short *cursor_pos = scp->cursor_pos;
|
||||
do {
|
||||
*cursor_pos++ = (scr_map[*ptr++] | cur_attr);
|
||||
/*
|
||||
* gcc-2.6.3 generates poor (un)sign extension code. Casting the
|
||||
* pointers in the following to volatile should have no effect,
|
||||
* but in fact speeds up this inner loop from 26 to 18 cycles
|
||||
* (+ cache misses) on i486's.
|
||||
*/
|
||||
#define UCVP(ucp) ((u_char volatile *)(ucp))
|
||||
*cursor_pos++ = UCVP(scr_map)[*UCVP(ptr)] | cur_attr;
|
||||
ptr++;
|
||||
cnt--;
|
||||
} while (cnt && PRINTABLE(*ptr));
|
||||
len -= (cursor_pos - scp->cursor_pos);
|
||||
|
@ -25,7 +25,7 @@
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $Id: syscons.c,v 1.117 1995/05/30 08:03:13 rgrimes Exp $
|
||||
* $Id: syscons.c,v 1.118 1995/06/14 05:16:12 bde Exp $
|
||||
*/
|
||||
|
||||
#include "sc.h"
|
||||
@ -1860,7 +1860,15 @@ outloop:
|
||||
u_short cur_attr = scp->term.cur_attr;
|
||||
u_short *cursor_pos = scp->cursor_pos;
|
||||
do {
|
||||
*cursor_pos++ = (scr_map[*ptr++] | cur_attr);
|
||||
/*
|
||||
* gcc-2.6.3 generates poor (un)sign extension code. Casting the
|
||||
* pointers in the following to volatile should have no effect,
|
||||
* but in fact speeds up this inner loop from 26 to 18 cycles
|
||||
* (+ cache misses) on i486's.
|
||||
*/
|
||||
#define UCVP(ucp) ((u_char volatile *)(ucp))
|
||||
*cursor_pos++ = UCVP(scr_map)[*UCVP(ptr)] | cur_attr;
|
||||
ptr++;
|
||||
cnt--;
|
||||
} while (cnt && PRINTABLE(*ptr));
|
||||
len -= (cursor_pos - scp->cursor_pos);
|
||||
|
Loading…
Reference in New Issue
Block a user