Skip to main content.
August 16th, 2008

wrath of the hunter king

Well, it’s about that time again. WoW’s second expansion is in beta, and will be bringing with it an absolutely staggering number of changes. So far, I am very pleased with the way things are going.

Today, I am going to try to confine my ramblings to the subject of the hunter talent tree upgrades. Pet changes, new spells, and upgrades to old spells will have to wait until a future post or two. And of course, I’ve also got to write about the priest changes. Hmm… And I’m trying to get my warlock to 70 before the expansion as well… Anyway. Hunters. Talents. Go.

Beast Mastery Talents - 53 points

  • Improved Aspect of the Hawk - rank 5/5
  • Endurance Training - rank 3/5
  • Focused Fire - rank 2/2
  • Aspect Mastery - rank 1/1
  • Unleashed Fury - rank 5/5
  • Ferocity - rank 5/5
  • Spirit Bond - rank 2/2
  • Intimidation - rank 1/1
  • Bestial Discipline - rank 2/2
  • Frenzy - rank 5/5
  • Ferocious Inspiration - rank 3/3
  • Bestial Wrath - rank 1/1
  • Catlike Reflexes - rank 3/3
  • Invigoration - rank 2/2
  • Serpent’s Swiftness - rank 5/5
  • Longevity - rank 3/3
  • The Beast Within - rank 1/1
  • Cobra Strikes - rank 3/3
  • Beast Mastery - rank 1/1

Marksmanship Talents - 5 points

  • Lethal Shots - rank 5/5

Survival Talents - 3 points

  • Hawk Eye - rank 3/3

Beastier Mastery

At present, my hunter is a pretty heavy beast mastery spec. If things remain largely unchanged, he will likely become even heavier beast spec immediately upon getting the expansion. Of course… there is so much goodness in the pending changes that I might not actually stick with beast spec much past 70, but this is my current plan for day one in Northrend.

First, let’s discuss what I’m planning on giving up (initially). In order to get 53 points in beast mastery, I will have to give up 11 points from marksmanship and survival. The talents that are going byebye:

But oh… oh what am I going to get in exchange :) It’s gonna rock.

Aspect Mastery is a new T3 beast talent. For one point, it buffs your 3 basic aspects. Viper gets +10% to its mana regen rate. Monkey gets 10% damage reduction - that’s right, flat out absorption when the dodge fails. This also means monkey now helps when you’re getting hit by spells. Hawk gets +50% to its AP bonus. At level 70, hawk is worth +155 AP, so this talent is worth +77 AP. At level 80, hawk will be worth +300 AP… ;)

While I’m going this deep in the tree (and since I don’t need the point for Aimed Shot any more), I’ll also be picking up a 3rd point in Catlike Reflexes for an additional +1% to my dodge and +3% to my pet’s dodge.

Invigoration is a new T8 beast talent that for two points causes you to instantly regenerate 2% of your mana every time your pet scores a crit with a special. My pre-existing talents already give my pet +10% crit chance and double focus regen. I’m losing the focus regen from Go for the Throat but am also picking up both of the new T9 talents…

Longevity costs 3 points at T9 beast and reduces cooldowns on Bestial Wrath, Intimidation, and all pet special abilities by 30%. Intimidate’s cooldown goes down from 60 seconds to 40; Bestial Wrath is down from 120 seconds to 84. These cooldowns were already short enough that I have macros that ensure I am able to burn them almost every time they’re up. The buff makes me giddy.

Reducing the cooldown on pet specials by 30% means I don’t have to rely on my pet’s focus dump ability any more. 30% more frequent crits from specials means 30% more frequent procs of Invigoration and happy joyful mana regeneration.

Cobra Strikes costs 3 points at T9 beast and gives me a 60% chance when I crit with Arcane, Steady, or Kill shot to cause my pet’s next 3 specials to crit… In conjunction with Invigoration, this effectively reduces the mana cost for my Steady shots into the realm of the microscopic.

And of course, then there’s Beast Mastery, the new T11 talent. This will allow me to tame exotic pets (devilsaur, chimera, silithid, etc…) and effectively gives all of my pets +20 levels worth of talent points.

The only new beast talents that I’m not actually picking up with this build are:

I’m vaguely torn by Separation Anxiety. Insert pun here. To pick it up immediately upon WotLK launch would mean foregoing +5% crit chance, and my crits already give my pet huge bonuses that I wouldn’t want to go without.

Of course… the other two talent trees have gotten an even bigger upgrade. Beast was already terribly overpowered, so it is only fair. If it weren’t for the lure of exotic pets, I’d be all over the other trees. As it is, I’m having a hard time deciding what I want out of their first 3 tiers.

Marksmanship

The changes to the marks tree mean major improvements to hunter shots, reliable improvements to baseline DPS, and absolute gobs of bonus mana efficiency.

One of my longstanding gripes has been Improved Concussive Shot. In BC, it was a 5 point talent that gave the dubious benefit of a 20% chance of proccing a 3 second stun in addition to the daze effect. There are numerous problems with this that I really don’t want to get into since the bad talent is finally going away. In return, we get a sleek new 2 point talent that increases the duration of the daze by 2 seconds. This is pure awesome. If I were leveling a newbie hunter, this would be my first talent, hands down.

T1 marks also gets the 3 point Focused Aim talent, which gives hunters the same sort of 70% interruption resistance (while charging Aimed & Steady) that other mana-using classes have traditionally been able to buy for low tier talents. I find this to be of questionable usefulness, however - especially since it’s a T1 talent that buffs abilities that aren’t available at level 10. Aimed shot is a T3 talent, so it is first available at level 20. Steady shot rank 1 is level 62…

T2 marks gets some amazing changes, I’ve already mentioned the buff to Improved Mark.

Careful Aim makes an appearance at T2. All the way down from T7. Yup. They moved a tier seven talent down to tier two. And then they buffed it 3x. In stead of a puny +45% of your int converted into RAP, it now gives a full +100%. Epic win.

They have also switched the locations of Mortal Shots (+crit damage) and Efficiency (-mana cost). Mortal Shots is now T2 and becomes Aimed Shot’s pre-req (in stead of the other way around). Efficiency wasn’t very important at low levels, so moving it up to T4 makes more sense (when it’s saving you more than 1 or 2 mana per spell).

In stead of Careful Aim at T7, marks hunters now get Piercing Shots for 3 points. This gives Steady and Aimed shots the ability to ignore 6% of target armour. Very unshabby.

Rapid Recuperation is a new 3 point T8 ability that helps mana efficiency. While using Rapid Fire, both the hunter’s and pet’s abilities are 60% cheaper. This makes for a lot of focus dump happiness for your pet. Additionally, Rapid Killing (which already reduces Rapid Fire’s cooldown) is improved by giving you a mana regen tick that heals you for 150% of the damage dealt by the +20% damage shot you fire to use the Rapid Killing charge. This is quite probably enough to keep high level hunters at full mana forever, so long as things keep dying.

Wild Quiver is a new T9 (3 point) talent that gives you a 10% chance to fire an additional auto shot at 60% damage. Combine this with the fact that heavy marks hunters will likely be using Improved Hawk in stead of Viper (since the marks tree is really taking care of the hunter’s mana needs without it now)… and you have a LOT of extra arrows flying.

T9 also gets Improved Steady Shot (3 points). This gives your steady shots 15% chance to increase the damage of your next aimed/arcane/kill shot by 15% while reducing its mana cost by 40%. See? I told you. Mana efficiency.

The new T10 marks talent is Marked for Death (5 points). It gives your already improved hunter’s mark an additional +10% damage dealt by the hunter & pet and increases your critical strike damage bonus of all shot spells by a further 10%. This really encourages the hunter to mark their targets but I wonder how it plays out with multiple hunters firing on the same target. Do they all get the bonus, or does only the hunter who placed the mark?

And Chimera Shot is the new T11 talent. It’s a 10 second cooldown shot for 125% damage that refreshes your current sting and procs an additional bonus depending on which sting was active. Serpent deals 40% of the sting’s normal damage instantly. Viper heals you for 60% of the amount it drains (mana efficiency). Scorpid procs a 10 second disarm attempt that can only occur once a minute. All told, way cool.

Survival

The big change at T1 for the survival tree is that the former pair of 3 point talents Monster Slaying and Humanoid Slaying have been replaced with the 5 point Improved Tracking. I’ve already discussed this above, but just to reiterate:

T2 gets a new talent called T.N.T.. Hehe. This gives your fire traps 15% chance to deal a 2 second stun when they do damage (I assume this means 15% each time the dot procs…). It also increases the crit chance of your explosive trap by 15%. And… the talent also extends these bonuses to your Explosive Shot (which is the new T11 talent that effectively acts as a ranged explosive trap). I could live with this.

Tier 2 also gets Survival Instincts. Yup, another high tier talent moving down into cherry picking range. They didn’t even nerf it in the process (but they didn’t buff it like they did Careful Aim). This formerly 5th tier talent gives you a whopping 4% damage reduction and 4% AP for 2 points.

T3 sees an upgraded version of Deflection. This talent previously cost 5 T2 points for +5% parry bonus. Now it costs 3 T4 points for +6% bonus. Deflection also becomes Counterattack’s new pre-req (since the old pre-req, Deterrence is becoming a baseline ability now). Win.

T3 also gets Trap Mastery, which is currently unimplemented. But I believe it is supposed to be a combination of the previous T3 Clever Traps talent and the previous T4 Trap Mastery talent.

And… T3 also gets an improved version of the formerly T4 Improved Feign Death. Survival Tactics (2 points) is Improved Feign Death (+4% to difficulty to resist feign) plus a 4 second reduction to Disengage’s cooldown.

At T4, Surefooted is slightly changed to cut the duration of snares in half. Previously it supposedly gave you a +15% chance to resist them, but I’m not the only one who’s noticed that a lot of CC/snare/etc… type effects are, well, simply irresistible. So this is a nice improvement. They’re actually doing this sort of thing all across the board (changing chance to resist effects that weren’t ever actually resistible to a reduction in that effect’s duration).

Lock and Load is a new 3 point T4 survival talent that gives you a crazy weird clearcasting type effect that procs whenever you trap a target or 15% of the time you sting something. The proc is that your next 3 arcane and explosive shots are free to cast and have no cooldown (they normally both have a 6 second cooldown). I really wonder if successive explosive shot dots stack… because explosive trap + 3x explosive shot = actual big boy aoe dps. This would actually make hunters vaguely useful in situations where previously only mages & warlocks would do.

Hunter vs Wild is a new T5 talent for 3 points that increases you and your pet’s AP by 30% of your total stamina. 5 points in Survivalist are the nominal pre-req, but when considering taking a talent like this, who’d pass up a +10% stamina bonus anyway?

Noxious Stings is new at T8 and has Wyvern as a pre-req and gives your wyvern sting a backlash effect that hits the dispeller for 50% of the remaining sting duration. In addition, it also increases all damage dealt to victims of your serpent sting by 3%. This really improves the usefulness of wyvern in pvp and makes serpent a nice addition to an improved mark in group situations. I don’t think this should be a T8 talent with a pre-req… but there really isn’t room to put it anywhere else ;)

Point of No Escape is a new T9 survival talent that costs 3 points and increases the crit chance of all attacks on victims of your ice traps (and possibly bear trap, but I think they’re doing away with that one). This is very nice for frost trap and potentially very very fun with the rumored changes to freeze trap (it won’t break on any old damage now). This means you might get to cycle off two big crit shots into something when breaking its freeze now.

Sniper Training is another new T9 talent (3 points). This increases the damage dealt by steady, aimed, and explosive shots by 6% when you are >30 yards away from the target. It also (possibly more importantly) improves your chance to crit by 15% when executing with Kill Shot. It’s kind of a shame this is so mutually exclusive with Separation Anxiety (+pet dps at long range).

The new T10 survival talent is Hunting Party (5 points) and serves as an awesome hunter version of Vampiric Touch (shadow priest spell that dots an enemy and turns the damage into mana for the party). Hunting Party has Thrill of the Hunt as a pre-req (regen 40% of shot costs when you crit) and heals your whole party’s mana/energy/rage/runic power slightly whenever you crit with an arcane/explosive/steady shot. Hehehe. Oh, and remember, TNT gives explosive shots +15% to crit while Lock and Load makes them subject to chain clearcasting :)

And of course then there’s Explosive Shot at T11. We’ve already seen numerous other talents that improve it, but what is it? It’s a ranged explosive trap on a 6 second cooldown. It hits the primary target for a good chunk of fire damage and then splashes everything within 5 yards with a dot for half of the base damage again over 2 seconds.

And so… with so many wonderful options, I am really starting to wish for the first time that they will let us dual spec somehow. It would mean I can keep my insanely heavy beast spec for soloing and take something from marks and/or survival for groups/pvp. Mmm. Happy ideas.

Anyhow, I’ve spent entirely too long on this, and now I’m less sure than ever of what I’ll be doing with my 10 shiny new lvl 71-80 talent points. Oh well. Respecs aren’t really that expensive after all.

Posted by Ammon as beta, games, hunters, mmorpg, numberchasing, play, warcraft, wotlk at 5:39 AM EDT

No Comments »

August 2nd, 2008

burn down the stables (or: the bland pet conundrum)

Two and a half months ago, I started writing a post on the topic of WoW hunter pets. In their present incarnation, they are boring and unbalanced. They’re difficult to learn how to use effectively and make tremendous time sinks.

In the time since I started this post WotLK has gone into beta and a lot of things have changed. They seem to be making similar choices to those I was guessing at, only much cooler ;)

However, since I hate to waste a good rant, I’m going to dust this thing off before it goes entirely stale. Let’s see what I can salvage.

<original-post>
Lately, there seems to have been a lot of discussion on the topic of hunter pets - especially in the wake of recent patches that have broken longstanding aggro mechanics.

Znodis seems to think that sweeping normalization of pets is inevitable - ie, all pets will eventually have identical stats and have access to the exact same set of skills. Mania agrees in part, but is hoping for a middle ground solution - where all pets become viable not by giving all pets access to all abilities, but by guaranteeing that all pets have access to at least one ability of a given variety.

I think that any sort of large scale normalization that negates Blizzard’s (now long-standing) trend of slowly releasing unique abilities for individual races of pets… would be a mistake.

The core of the argument seems to be thus:

  1. Some pets are useless.
  2. Because of this, people tend to gravitate toward 2 or 3 distinct sets of pets - even though there are some 20+ varieties available.

You don’t see warlocks rioting in the streets because they have never had even the illusion of choice in their pets. Warlocks get a handful of pets, each of which is completely identical to any other comparably leveled and specced warlock’s version of the pet. They have a few novelty pets that come out for parties… but they generally stick to 2 or 3 different pets for 99% of all situations.

Hunters at least have a choice. They can use monkeys and flamingos and crabs if they want to. Not that there is any compelling reason to do so, other than the fact that staring at an endless array of cats, bears, pigs, and birds over the course of one’s entire hunter career gets a bit boring.

This is apparently a bad thing.

I think the only bad thing here is that Blizzard is wasting effort releasing pets that almost nobody uses. Why bother making spore bats tamable in the first place? No hunter big enough to tame one is going to waste his limited pet slots on… well, a complete waste of a slot. Not when there are pets out there that can hold aggro and eat conveniently available food and maybe do some damage while they’re at it…

The proposals I’ve seen from other hunters:

  1. Do away with useless pets forever.
  2. Make all pets the same.
  3. Make all pets mostly the same.
  4. Take the time to balance each pet type and encourage people to use them.

Nobody’ll bite the first option. They’re in game, it doesn’t do any real harm to leave them in.

Two and three are really the same thing. Turn pets into pretty skins around an otherwise identical blob of function. We’re already frighteningly close to this. Different attack speeds were done away with. Different travel speeds were done away with. Large pools of shared trainable abilities were added to allow hunters to respec around a pet’s natural deficiencies.

And nobody thinks that option 4 will fly either - nobody seems to think that Blizzard cares enough to dedicate the resources. And while I’m loathe to agree… I’d like to think that a compromise will be made. Blizzard clearly wants us to use different pets, they just don’t want to make them very interesting.

I’d like to suggest my own wacky solution.

burn down the stables

Stables are a pain, and they’re an unnecessary restriction on the class. Who else has to run back to an inn (or even more inconvenient location in some towns) to change their equipment? I mean, if a feral druid knows they might need to switch into a healing role for part of an instance run, they can always just carry a change of clothes.

This restriction becomes even more arbitrary feeling in the face of Death Knights possibly being able to perform little ‘mini-respecs’ in the field. Warlocks can cycle through pets during combat - they can even spec to improve this process, why does a hunter have to run all the way to the back corner of Orgrimmar to trade their bear in for an owl?

But even worse than the arbitrariness of the stable system is the simple fact that it’s had a glaring bug since beta that nobody’s bothered fixing. Non-hunters can buy stable slots. They can’t use them for anything. So unlike a mage portal trainer who refuses to talk to non-mages, the stable master is more than happy to talk to and steal money from non-hunters.

And the stables don’t even always work. I’ve had pets get stuck in the stable and require GM assistance to extricate. And then there’s the elusive virtual pet slot that sometimes exists and sometimes doesn’t, depending on how you juggle things…

The system was clearly a rushed job that hasn’t had an ounce of polish in over three years. I say get rid of it, and replace it with something that works.

so now what?

Well, now we let hunters switch pets in the field. Just like mini-pets take up a player’s inventory, I’m willing to sacrifice some inventory room for the ability to take 3 or 4 pets adventuring with me.

This could be justified by giving the hunters a number of ‘whistles’ that are associated with new pets as they’re captured. If they abandon a pet, the whistle becomes disassociated.

Allow hunters to capture pets even when they don’t have a free whistle slot (similar to a warlock’s enslave). Pets captured in this way do not gain loyalty and cannot be fed, so they’ll run away after a while. They do not persist through a logout, and they cannot be raised if they die. Since they have no training points and do -25% damage, they’re not useful as permanent pets - but they are useful to learn abilities and as a means of crowd control.
</original-post>

Well, that wasn’t terribly outdated after all. Most of the changes (beta changes, so not entirely guaranteed to go live, of course) that obsolete some of my opinions are:

  1. Mini-pets are going into your spellbook.
  2. The stable might have been increased in size by 2 slots.
  3. All pet races have a unique ability.
  4. Bite has been nerfed to act as simply another name for claw (a focus dump). Every race gets one or the other.
  5. Pets now magically learn new abilities as they level, thus eliminating the need to go out and tame a lvl 63 ravager to teach your level 64 boar rank 9 gore…
  6. Pets automatically level up to a minimum of 5 below their owner when tamed.
  7. Loyalty is quite probably going away, so that’s no longer a concern for the ‘enslaved’ pets I was pondering.
  8. Along with loyalty, the often confusing training point system is gone and has been replaced with a much nicer and more familiar talent system. Each pet family falls into one of 3 trees.

So what does this all mean? It means that Blizzard is normalizing pets in the best possible way. It means that there will finally be a real reason (other than aesthetics) to choose weird pet races. It means that I’m absolutely going to maintain a minimum of 3 pets now, and will have an easier time of doing it.

It also means that we have a slim chance that they will actually burn the stables down (by making pets into spells, just like mini-pets and mounts). I’m guessing that they’ll try to live with the broken stable system for a bit longer (as evidenced by their expanding it to 5 slots from 3), but I’m hoping that this is just a temporary mechanism that will be done away with when the expansion goes final (or in the patch immediately following).

I mean… they’re already getting rid of the pet trainers… and they’ve already written most of the systems we’d need for it… so why not get rid of the stables as well? Here’s to hoping.

Because encouraging us to keep more pets around without similarly increasing our access to said pets is just plain mean :P

Posted by Ammon as games, hunters, ideas, mmorpg, play, sleep, warcraft, wotlk at 2:13 PM EDT

No Comments »

July 2nd, 2008

ccent

So… I just finished the first half of my CCNA today.

I never really cared about networking much beyond that needed to make sure clients on a lan can talk to their dns server… but we’ve been growing enough here at work that the needs quickly outpaced my prior skillset. And since I was the closest thing we had to a network admin, I got signed up for classes ;)

It’s been fun and profoundly enlightening. I didn’t expect to have my way of thinking so radically altered, but I’m hardly complaining.

I’ll be starting up the second class in a week or two. This’ll include such topics as VLANs, IPv6, and fancy routing protocols. I’m stoked.

It’s funny. I never finished college (though I took classes for roughly 10 years), so this is actually the first certificate of education I’ve received since highschool.

The comment was made at work that I’d dinged as a sysadmin. I haven’t. I’m just cherry picking my next few levels in netadmin ;)

Posted by Ammon as play at 2:25 PM EDT

No Comments »

May 27th, 2008

svn get revision

One of the more annoying things about svn is that (to my knowledge), there exists no single simple command to retrieve the revision number from a shell.

What I want:

ammon@hermes:~/repo$ svn info --get-revision .
1234

But of course, nothing like this exists.

Thankfully, svn info's output IS easy enough to parse. You just have to do it your self.

ammon@hermes:~/repo$ svn info | grep Revision | awk -- '{print $2}'
1234

Will give you the revision of your current checkout without the network hit of a call to svn log.

To get the current version of the repo itself (hits the network), add "-r HEAD" to the svn info call:

ammon@hermes:~/repo$ svn info -r HEAD | grep Revision | awk -- '{print $2}'
1280

Of course, svn info also supports outputting info as xml, so you could use that to parse things in a more advanced environment but one where you're still not using the svn api bindings.

Posted by Ammon as play at 12:57 PM EDT

No Comments »

php tail

I have a php script that frequently needs to email me the last few lines of a log file. I can't afford to exec() a binary tail process, so the solution has to be in pure php.

Originally, the files in question never exceeded more than a few thousand lines. Unfortunately, I am encountering cases now where the files are now occasionally 50,000 lines or longer. This causes PHP's memory consumption to explode.

Note: Code snippets provided here are not fully functional standalone shell scripts. The scripts I ran to benchmark the algorithms contain some rudimentary setup logic that is not important here, so has not been included.

My original method:

// tail-file.php
$arr = @file( $fname, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES );
$arr = array_slice($arr, -$lines);
$buf = implode("\n",$arr);

This is easy to understand and is pretty fast, all things considered. Unfortunately, the memory footprint for loading a file into an array is obscene. Loading a 4400 line log file with this method could consume more than 17mb of ram. 50,000 line files easily stressed the 256mb limit I am able to provide the process.

So, the obvious solution to the memory consumption is to avoid loading the entire file at once. What if we kept a rotating list of lines in the file?

// tail-array.php
$arr = array_fill( 0, $lines+1, "\n" );

$fp = fopen($fname, "r");
while( !feof($fp) ) {
    $line = fgets($fp, 4096);
    $arr[] = $line; // faster than array_push()
    array_shift($arr);
}
fclose($fp);
$buf = implode("",$arr);

This method works by keeping the $lines-many most recent lines of the file in an array. Memory consumption remains sane, but the performance hit for performing so many array pushes and shifts is bad. Really bad. With small files, I can't notice any difference between this method and the file() method... but with longer files, it adds up quickly.

Given a 51 line, 4kb file, an average execution ($lines = 20) might look like this:

ammon@zap:~$ time ./tail-file.php a.log>/dev/null

real    0m0.015s
user    0m0.009s
sys     0m0.007s

ammon@zap:~$ time ./tail-array.php a.log>/dev/null

real    0m0.016s
user    0m0.010s
sys     0m0.006s

Comparable enough. But given a 50,004 line (3.3mb) log file:

ammon@zap:~$ time ./tail-file.php b.log >/dev/null                  

real    0m0.079s
user    0m0.058s
sys     0m0.021s

ammon@zap:~$ time ./tail-array.php b.log >/dev/null                 

real    0m0.119s
user    0m0.112s
sys     0m0.007s

The difference becomes quite clear. However... what if my log file grows obscenely large? I've got a 9 million line log file (1.6gb) lying around to test with...

ammon@zap:~$ time ./tail-file.php c.log >/dev/null

real    0m0.015s
user    0m0.008s
sys     0m0.008s

ammon@zap:~$ time ./tail-array.php c.log >/dev/null                 

real    0m19.351s
user    0m18.545s
sys     0m0.803s

The file() method crashes because it can't allocate enough ram to hold a 9 million element array and the array method takes almost 20 seconds to execute. It's slow... but at least it works.

Of course, there are other methods. The one I finally settled on is this:

// tail-seek.php
$fp = fopen($fname, "r");
$lines_read = 0;
if( $fp !== FALSE ) {
    fseek( $fp, 0, SEEK_END );
    $pos = $eof = ftell($fp);
    do {
        --$pos;
        fseek($fp, $pos);
        $c = fgetc($fp);
        if( $c == "\n" )
            $lines_read++;
    } while( $pos> 0 && $lines_read <= $lines );
    $buf = fread($fp, $eof-$pos);
}
fclose($fp);

This method doesn't waste time reading the bulk of the file. It jumps to the end and scans backward until enough newlines have been located. The only problem here is that your average filesystem isn't optimized for reading backwards... but since we're not really reading very much data, it doesn't much matter.

ammon@zap:~$ time ./tail-seek.php a.log >/dev/null

real    0m0.017s
user    0m0.009s
sys     0m0.008s

ammon@zap:~$ time ./tail-seek.php b.log >/dev/null                  

real    0m0.017s
user    0m0.008s
sys     0m0.010s

ammon@zap:~$ time ./tail-seek.php c.log >/dev/null                  

real    0m0.023s
user    0m0.015s
sys     0m0.008s

Performance is a trifle slower on small files, but it's astronomically better on long ones. This is similar to the method used by most unix 'tail' commands, and is the clear winner for actual use in my application.

Of course, it needs a bit of cleanup from the state I've provided it in, and isn't appropriate for all environments... but it's a trifle better than requiring 20 seconds and 20gb of ram to execute ;)

Posted by Ammon as play at 12:08 PM EDT

No Comments »

« Previous Entries