Exploring Built In Functions

An issue I have been pondering lately is how much time to dedicate to trawling through programming language manuals and doc files looking for built in functions to perform a particular task.

Obviously there are some functions that you can pretty much take for granted will be provided for by the language, an example would be returning the size of the array. We know that each language might have slightly different terminology for performing this basic task but we also know it should be there and is most likely going to be easy to find - a very quick google will tell you what you need to know and you can carry on with your life.

But what about some of the more fiddly functions? An example would be the large array*1 of functions you can call in PHP to do some fairly cool stuff to arrays and I know that the majority of these functions are not going to be available in say JavaScript. Normally I would have a quick google and if nothing immediately jumps out at me and I know I have a rough idea of how to recreate this bit of code then I will just go ahead and write it myself. I think there are a few pros and cons to what I do.

Pros;

I get to think about the best way to make these functions.

I get to create the function exactly how I want.

I get to create!

I am not wasting time searching for something that may not exist.

Cons;

It is generally going to be slower to write it from scratch than it would be to spend some more time digging about to find the appropriate function.

I am not fully getting my teeth into the language or taking benefit from its internal libraries.

If there is an in built method already in place, I am sure it is going to be far more optimised for the task than my method is*2

Lets now say that we have looked through the manual for the language and done some googling and we are pretty confident that a function doesn't exist natively, it seems to me that we then have a couple of choices; we can see if someone else has created similar methods/libraries/functions or we can create them ourselves. Obviously there are pros and cons to finding someone else's.

Pros;

Can be quicker.

Already documented.

Sometimes there is community support

Cons;

It will never do 100% what you want it to do.

You will never learn how to solve the problem for yourself (but if there is a solution, then is it worth you solving it again?)

The pros and cons for creating it yourself is pretty much the reverse of the above!

I guess what I am asking, in a rather round about way, is how much time do you spending searching for a pre-built solution against writing your own?

*1 - Do you see what I did there? An array of functions? Har har har!!
*2 - Actually, I am not convinced this is true, most in built functions have to be fairly generic, I can streamline my functions to do what I want them to do, but for example I know that creating a function to return the size of an array is going to be less efficient at run time than using sizeof(), no matter what awesome stuff I do within that method.