Skip to content
This repository has been archived by the owner on May 4, 2018. It is now read-only.

Add the throw_safe variable to the uv_fs_s struct #1428

Closed
wants to merge 1 commit into from

Conversation

errendir
Copy link

This variable is meant to control whether IO errors are created or not.
This enables: nodejs/node-v0.x-archive#8189

The general idea is to throw less errors that are immediately caught.
This throw and catch behaviour is present in the module.js and can
significantly slow down the require calls (especially in case of coffeescript).

This variable is meant to control whether IO errors are created or not.
This enables: nodejs/node-v0.x-archive#8189

The general idea is to throw less errors that are immediately caught.
@saghul
Copy link
Contributor

saghul commented Aug 19, 2014

Sorry, this is not the right place to add this. libuv is not Node, it's written in C and has no knowledge of what "throwing" is or who should use it. If you need extra fields just in Node you can define a struct as follows:

typedef struct node_fs_s {
    uv_fs_t req;
    int throw_safe;
} node_fs_t;

This way you can cast the uv_fs_t to node_fs_t on libuv callbacks, without having to pollute libuv.

@saghul saghul closed this Aug 19, 2014
@txdv
Copy link
Contributor

txdv commented Aug 19, 2014

He just added a variable without using it?

@saghul
Copy link
Contributor

saghul commented Aug 19, 2014

@txdv yes, it's supposed to be used by Node, check the link provided in the original message. That's why it has no place in libuv.

errendir pushed a commit to errendir/node that referenced this pull request Aug 19, 2014
errendir pushed a commit to errendir/node that referenced this pull request Aug 19, 2014
errendir added a commit to errendir/node that referenced this pull request Aug 19, 2014
errendir added a commit to errendir/node that referenced this pull request Aug 19, 2014
In some environment (especially when coffescript is involved) module.js
will spend a lot of time looking up nonexisting files. This is caused by the
lengthy error creation. Those errors are then immediately caught.

This change makes the lookup much faster, by avoiding the unnecessary error
creation.

module::statPath now uses the new second parameter of fs.statSync function of the
fs.js. There is a similar change for the fs.stat, adding the third parameter.

Apply suggestions from libuv pull request

Thanks saghul: joyent/libuv#1428

Fix the datastructures for async
errendir added a commit to errendir/node that referenced this pull request Aug 20, 2014
In some environment (especially when coffescript is involved) module.js
will spend a lot of time looking up nonexisting files. This is caused by the
lengthy error creation. Those errors are then immediately caught.

This change makes the lookup much faster, by avoiding the unnecessary error
creation.

module::statPath now uses the new second parameter of fs.statSync function of the
fs.js. There is a similar change for the fs.stat, adding the third parameter.

Apply suggestions from libuv pull request

Thanks saghul: joyent/libuv#1428

Fix the datastructures for async
errendir added a commit to errendir/node that referenced this pull request Sep 3, 2014
In some environment (especially when coffescript is involved) module.js
will spend a lot of time looking up nonexisting files. This is caused by the
lengthy error creation. Those errors are then immediately caught.

This change makes the lookup much faster, by avoiding the unnecessary error
creation.

module::statPath now uses the new second parameter of fs.statSync function of the
fs.js. There is a similar change for the fs.stat, adding the third parameter.

Apply suggestions from libuv pull request

Thanks saghul: joyent/libuv#1428

Fix the datastructures for async

Conflicts:
	lib/module.js
	src/node_file.cc
	src/node_file.h
errendir added a commit to errendir/node that referenced this pull request Sep 3, 2014
In some environment (especially when coffescript is involved) module.js
will spend a lot of time looking up nonexisting files. This is caused by the
lengthy error creation. Those errors are then immediately caught.

This change makes the lookup much faster, by avoiding the unnecessary error
creation.

module::statPath now uses the new second parameter of fs.statSync function of the
fs.js. There is a similar change for the fs.stat, adding the third parameter.

Apply suggestions from libuv pull request

Thanks saghul: joyent/libuv#1428

Fix the datastructures for async

Conflicts:
	lib/module.js
	src/node_file.cc
	src/node_file.h
errendir added a commit to errendir/node that referenced this pull request Sep 3, 2014
In some environment (especially when coffescript is involved) module.js
will spend a lot of time looking up nonexisting files. This is caused by the
lengthy error creation. Those errors are then immediately caught.

This change makes the lookup much faster, by avoiding the unnecessary error
creation.

module::statPath now uses the new second parameter of fs.statSync function of the
fs.js. There is a similar change for the fs.stat, adding the third parameter.

Apply suggestions from libuv pull request

Thanks saghul: joyent/libuv#1428

Fix the datastructures for async

Documentation update

Add tests and simplify Stat function

Apply the code review comments
errendir added a commit to errendir/node that referenced this pull request Sep 3, 2014
In some environment (especially when coffescript is involved) module.js
will spend a lot of time looking up nonexisting files. This is caused by the
lengthy error creation. Those errors are then immediately caught.

This change makes the lookup much faster, by avoiding the unnecessary error
creation.

module::statPath now uses the new second parameter of fs.statSync function of the
fs.js. There is a similar change for the fs.stat, adding the third parameter.

Apply suggestions from libuv pull request

Thanks saghul: joyent/libuv#1428

Fix the datastructures for async

Documentation update

Add tests and simplify Stat function

Apply the code review comments
errendir added a commit to errendir/node that referenced this pull request Sep 3, 2014
In some environment (especially when coffescript is involved) module.js
will spend a lot of time looking up nonexisting files. This is caused by the
lengthy error creation. Those errors are then immediately caught.

This change makes the lookup much faster, by avoiding the unnecessary error
creation.

module::statPath now uses the new second parameter of fs.statSync function of the
fs.js. There is a similar change for the fs.stat, adding the third parameter.

Apply suggestions from libuv pull request

Thanks saghul: joyent/libuv#1428

Fix the datastructures for async

Documentation update

Add tests and simplify Stat function

Apply the code review comments
errendir added a commit to errendir/node that referenced this pull request Sep 8, 2014
In some environment (especially when coffescript is involved) module.js
will spend a lot of time looking up nonexisting files. This is caused by the
lengthy error creation. Those errors are then immediately caught.

This change makes the lookup much faster, by avoiding the unnecessary error
creation.

module::statPath now uses the new second parameter of fs.statSync function of the
fs.js. There is a similar change for the fs.stat, adding the third parameter.

Apply suggestions from libuv pull request

Thanks saghul: joyent/libuv#1428

Fix the datastructures for async

Documentation update

Add tests and simplify Stat function

Apply the code review comments
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants