Solved Why is my system so slow?

Bill Evans at Mariposa

Active Member

Reaction score: 16
Messages: 114

This might seem a question about less, but I don't think it is.

I have two systems with basically the same hardware, one running Linux and one running 10.2-RELEASE. On each, I run less on a half-megabyte text file. On FreeBSD, it takes almost a minute for data to show on the screen. On Linux, that happens almost instantly.

What should I be fine tuning on the FreeBSD system to speed this up?

I don't think it's an issue with less. The problem happens on FreeBSD whether I use the less that comes with FreeBSD (version 458), or use a less I've compiled from the latest available at gnu (version 481). The Linux fast performance happens whether I use the less that comes with my Linux system (less version 444), or use a less I've compiled from the latest available at gnu (version 481).
 

wblock@

Administrator
Staff member
Administrator
Moderator
Developer

Reaction score: 3,634
Messages: 13,850

Different settings between the two, like line numbers or something that must be calculated? I've never seen less(1) take much time to show anything, even on huge files.
 
OP
OP
Bill Evans at Mariposa

Bill Evans at Mariposa

Active Member

Reaction score: 16
Messages: 114

I can't find any differences between the two environments. But if I unset LESSOPEN, the problem goes away. I'm continuing to investigate.
 
OP
OP
Bill Evans at Mariposa

Bill Evans at Mariposa

Active Member

Reaction score: 16
Messages: 114

Bingo. Off the shelf, 10.2-RELEASE provides a /usr/bin/lesspipe.sh that runs fast and is so breathtakingly simple that I can quote it here in its entirety without even needing to catch my breath:
Code:
#! /bin/sh
# ex:ts=8

# $FreeBSD: releng/10.2/usr.bin/less/lesspipe.sh 207842 2010-05-10 06:59:50Z mm $

case "$1" in
  *.Z)
  exec uncompress -c "$1" 2>/dev/null
  ;;
  *.gz)
  exec gzip -d -c "$1"  2>/dev/null
  ;;
  *.bz2)
  exec bzip2 -d -c "$1"  2>/dev/null
  ;;
  *.xz)
  exec xz -d -c "$1"  2>/dev/null
  ;;
  *.lzma)
  exec lzma -d -c "$1"  2>/dev/null
  ;;
esac
But did I use it? Nooooo, I had to fall for the ol' "install package lesspipe, it looks attractive" trick. I tried looking at /usr/local/bin/lesspipe.sh, and my eyes glazed over. By amazing coincidence, my eyes also glazed over as I waited for less to finally come back.
 
Top